Home

Awesome

ConceptNet Numberbatch

The best pre-computed word embeddings you can use

ConceptNet Numberbatch is a set of semantic vectors (also known as word embeddings) that can be used directly as a representation of word meanings or as a starting point for further machine learning.

ConceptNet Numberbatch is part of the ConceptNet open data project. ConceptNet is a knowledge graph that provides lots of ways to compute with word meanings, one of which is word embeddings, while ConceptNet Numberbatch is a snapshot of just the word embeddings.

These embeddings benefit from the fact that they have semi-structured, common sense knowledge from ConceptNet, giving them a way to learn about words that isn't just observing them in context.

Numberbatch is built using an ensemble that combines data from ConceptNet, word2vec, GloVe, and OpenSubtitles 2016, using a variation on retrofitting. It is described in the paper ConceptNet 5.5: An Open Multilingual Graph of General Knowledge, presented at AAAI 2017.

Unlike most embeddings, ConceptNet Numberbatch is multilingual from the ground up. Words in different languages share a common semantic space, and that semantic space is informed by all of the languages.

Evaluation and publications

ConceptNet Numberbatch can be seen as a replacement for other precomputed embeddings, such as word2vec and GloVe, that do not include the graph-style knowledge in ConceptNet. Numberbatch outperforms these datasets on benchmarks of word similarity.

ConceptNet Numberbatch took first place in both subtasks at SemEval 2017 task 2, "Multilingual and Cross-lingual Semantic Word Similarity". Within that task, it was also the first-place system in each of English, German, Italian, and Spanish. The result is described in our ACL 2017 SemEval paper, "Extending Word Embeddings with Multilingual Relational Knowledge".

The code and papers were created as a research project of Luminoso Technologies, Inc., by Robyn Speer, Joshua Chin, Catherine Havasi, and Joanna Lowry-Duda.

Graph of performance on English evaluations

Now with more fairness

Word embeddings are prone to learn human-like stereotypes and prejudices. ConceptNet Numberbatch 17.04 and later counteract this as part of the build process, leading to word vectors that are less prejudiced than competitors such as word2vec and GloVe. See our blog post on reducing bias.

Graph of biases

A paper by Chris Sweeney and Maryam Najafian, "A Transparent Framework for Evaluating Unintended Demographic Bias in Word Embeddings", independently evaluates bias in precomputed word embeddings, and finds that ConceptNet Numberbatch is less likely than GloVe to inherently lead to demographic discrimination.

Code

Since 2016, the code for building ConceptNet Numberbatch is part of the ConceptNet code base, in the conceptnet5.vectors package.

The only code contained in this repository is text_to_uri.py, which normalizes natural-language text into the ConceptNet URI representation, allowing you to look up rows in these tables without requiring the entire ConceptNet codebase. For all other purposes, please refer to the ConceptNet code.

Out-of-vocabulary strategy

ConceptNet Numberbatch is evaluated with an out-of-vocabulary strategy that helps its performance in the presence of unfamiliar words. The strategy is implemented in the ConceptNet code base. It can be summarized as follows:

Downloads

ConceptNet Numberbatch 19.08 is the current recommended download.

This table lists the downloads and formats available for multiple recent versions:

VersionMultilingualEnglish-onlyHDF5
19.08numberbatch-19.08.txt.gznumberbatch-en-19.08.txt.gz19.08/mini.h5
17.06numberbatch-17.06.txt.gznumberbatch-en-17.06.txt.gz17.06/mini.h5
17.04numberbatch-17.04.txt.gznumberbatch-en-17.04b.txt.gz17.05/mini.h5
17.02numberbatch-17.02.txt.gznumberbatch-en-17.02.txt.gz
16.0916.09/numberbatch.h5

The 16.09 version was the version published at AAAI 2017. You can reproduce its results using a Docker snapshot of the conceptnet5 repository. See the instructions on the ConceptNet wiki.

The .txt.gz files of term vectors are in the text format used by word2vec, GloVe, and fastText.

The first line of the file contains the dimensions of the matrix:

9161912 300

Each line contains a term label followed by 300 floating-point numbers, separated by spaces:

/c/en/absolute_value -0.0847 -0.1316 -0.0800 -0.0708 -0.2514 -0.1687 -...
/c/en/absolute_zero 0.0056 -0.0051 0.0332 -0.1525 -0.0955 -0.0902 0.07...
/c/en/absoluteless 0.2740 0.0718 0.1548 0.1118 -0.1669 -0.0216 -0.0508...
/c/en/absolutely 0.0065 -0.1813 0.0335 0.0991 -0.1123 0.0060 -0.0009 0...
/c/en/absolutely_convergent 0.3752 0.1087 -0.1299 -0.0796 -0.2753 -0.1...

The HDF5 files are the format that ConceptNet uses internally. They are data tables that can be loaded into Python using a library such as pandas or pytables.

The "mini.h5" files trade off a little bit of accuracy for a lot of memory savings, taking up less than 150 MB in RAM, and are used to power the ConceptNet API.

License and attribution

These vectors are distributed under the CC-By-SA 4.0 license. In short, if you distribute a transformed or modified version of these vectors, you must release them under a compatible Share-Alike license and give due credit to Luminoso.

Some suggested text:

This data contains semantic vectors from ConceptNet Numberbatch, by
Luminoso Technologies, Inc. You may redistribute or modify the
data under the terms of the CC-By-SA 4.0 license.

If you build on this data, you should cite it. Here is a straightforward citation:

Robyn Speer, Joshua Chin, and Catherine Havasi (2017). "ConceptNet 5.5: An Open Multilingual Graph of General Knowledge." In proceedings of AAAI 2017.

In BibTeX form, the citation is:

@inproceedings{speer2017conceptnet,
    title = {{ConceptNet} 5.5: An Open Multilingual Graph of General Knowledge},
    url = {http://aaai.org/ocs/index.php/AAAI/AAAI17/paper/view/14972},
    author = {Speer, Robyn and Chin, Joshua and Havasi, Catherine},
    year = {2017},
    pages = {4444--4451}
}

This data is itself built on:

Language statistics

The multilingual data in ConceptNet Numberbatch represents 78 different language codes, though some have vocabularies with much more coverage than others. The following table lists the languages and their vocabulary size.

You may notice a focus on even the smaller and historical languages of Europe, and under-representation of widely-spoken languages from outside Europe, which is an effect of the availability of linguistic resources for these languages. We would like to change this, but it requires finding good source data for ConceptNet in these under-represented languages.

Because Numberbatch contains word forms, inflected languages end up with larger vocabularies.

These vocabulary sizes were updated for ConceptNet Numberbatch 19.08.

codelanguagevocab size
frFrench1388686
laLatin855294
esSpanish651859
deGerman594456
itItalian557743
enEnglish516782
ruRussian455325
zhChinese307441
fiFinnish267307
ptPortuguese262904
jaJapanese256648
nlDutch190221
bgBulgarian178508
svSwedish167321
plPolish152949
noNorwegian Bokmål105689
eoEsperanto96255
thThai95342
slSlovenian91134
msMalay90554
csCzech88613
caCatalan87508
arArabic85325
huHungarian74384
seNorthern Sami67601
shSerbian66746
elGreek65905
glGalician59006
daDanish57119
faPersian53984
roRomanian51437
trTurkish51308
isIcelandic48639
euBasque44151
koKorean42106
viVietnamese39802
gaIrish36988
grcAncient Greek36977
ukUkrainian36851
lvLatvian36333
heHebrew33435
mkMacedonian33370
kaGeorgian32338
hyArmenian29844
skSlovak29376
ltLithuanian28826
astAsturian28401
mgMalagasy26865
etEstonian26525
ocOccitan26095
filFilipino25088
ioIdo25004
hsbUpper Sorbian24852
hiHindi23538
teTelugu22173
beBelarusian22117
froOld French21249
sqAlbanian20493
mul(Multilingual, such as emoji)19376
cyWelsh18721
xclClassical Armenian18420
azAzerbaijani17184
kkKazakh16979
gdScottish Gaelic16827
afAfrikaans16132
foFaroese15973
angOld English15700
kuKurdish13804
voVolapük12731
taTamil12690
urUrdu12006
swSwahili11150
saSanskrit11081
nrfNorman French10048
nonOld Norse8536
gvManx8425
nvNavajo8232
rupAromanian5107

Referred here from an old version?

An unpublished paper of ours described the "ConceptNet Vector Ensemble", and refers to a repository that now redirects here, and an attached store of data that is no longer hosted. We apologize, but we're not supporting the unpublished paper. Please use a newer version and use the currently supported ConceptNet build process.

Image credit

The otter logo was designed by Christy Presler for The Noun Project, and is used under a Creative Commons Attribution license.