bootleg

Self-Supervision for Named Entity Disambiguation at the Tail

Showing:

Popularity

Downloads/wk

0

GitHub Stars

126

Maintenance

Last Commit

5d ago

Contributors

7

Package

Dependencies

24

License

Categories

Readme

GitHub Workflow Status codecov Documentation Status license

Self-Supervision for Named Entity Disambiguation at the Tail

Bootleg is a self-supervised named entity disambiguation (NED) system for English built to improve disambiguation of entities that occur infrequently, or not at all, in training data. We call these entities tail entities. This is a critical task as the majority of entities are rare. The core insight behind Bootleg is that these tail entities can be disambiguated by reasoning over entity types and relations. We give an overview of how Bootleg achieves this below. For details, please see our blog post and paper.

Note that Bootleg is actively under development and feedback is welcome. Submit bugs on the Issues page or feel free to submit your contributions as a pull request.

Update 9-25-2021: We changed our architecture to be a biencoder. Our entity textual input still has all the goodness of types and KG relations, but our model now requires less storage space and has improved performance. A secret to getting the biencoder to work over the tail was heavy masking of the mention in the context encoder and entity title in the entity encoder.

Update 2-15-2021: We made a major rewrite of the codebase and moved to using Emmental for training--check out the changelog for details)

Getting Started

Install via

git clone git@github.com:HazyResearch/bootleg bootleg
cd bootleg
python3 setup.py install

Checkout out our installation and quickstart guide here.

Models

Below is the link to download the English Bootleg model. The download comes with the saved model and config to run the model. We show in our quickstart guide and end-to-end tutorial how to load a config and run a model.

ModelDescriptionNumber ParametersLink
BootlegUncasedUses titles, descriptions, types, and KG relations. Trained on uncased data.110MDownload

Embeddings

Below is the link to download a dump of all entity embeddings from our entity encoder. Follow our entity profile tutorial here to load our EntityProfile. From there, you can use our get_eid method to access the row id for an entity.

EmbeddingsDescriptionNumber ParametersLink
5.8M Wikipedia EntitiesEmbeddings from BootlegUncased.1.2BDownload

Metadata

Below is the link to download a dump of all entity metadata to use in our entity profile tutorial here.

MetadataDescriptionLink
5.8M Wikipedia EntitiesWikidata metadata for entities.Download

Tutorials

We provide tutorials to help users get familiar with Bootleg here.

Bootleg Overview

Given an input sentence, Bootleg takes the sentence and outputs a predicted entity for each detected mention. Bootleg first extracts mentions in the sentence, and for each mention, we extract its set of possible candidate entities and any structural information about that entity, e.g., type information or knowledge graph (KG) information. Bootleg leverages this information to generate an entity embedding through a Transformer entity encoder. The mention and its surrounding context is encoded in a context encoder. The entity with the highest dot product with the context is selected for each mention.

Dataflow

More details can be found here

Inference

Given a pretrained model, we support three types of inference: --mode eval, --mode dump_preds, and --mode dump_embs. Eval mode is the fastest option and will run the test files through the model and output aggregated quality metrics to the log. Dump_preds mode will write the individual predictions and corresponding probabilities to a jsonlines file. This is useful for error analysis. Dump_embs mode is the same as dump_preds, but will additionally output entity embeddings. These can then be read and processed in a downstream system. See this notebook to see how with a downloaded Bootleg model.

Entity Embedding Extraction

As we have a separate encoder for generating an entity representation, we also support the ability to dump all entities to create a single entity embedding matrix for use downstream. This is done through the bootleg.extract_all_entities script. See this notebook to see how with a downloaded Bootleg model.

Training

We recommend using GPUs for training Bootleg models. For large datasets, we support distributed training with Pytorch's Distributed DataParallel framework to distribute batches across multiple GPUs. Check out the Basic Training and Advanced Training tutorials for more information and sample data!

Downstream Tasks

Bootleg produces contextual entity embeddings (as well as learned static embeddings) that can be used in downstream tasks, such as relation extraction and question answering. Check out the tutorial to see how this is done.

Other Languages

The released Bootleg model only supports English, but we have trained multi-lingual models using Wikipedia and Wikidata. If you have interest in doing this, please let us know with an issue request or email lorr1@cs.stanford.edu. We have data prep code to help prepare multi-lingual data.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial