The Dataset Viewer has been disabled on this dataset.

mGENRE title trie + Wikidata QID lookup — impresso NEL assets

Two marisa-trie native binaries that support multilingual entity linking with mGENRE. They are the runtime assets for the impresso-project/nel-mgenre-multilingual model as run by the impresso-inference harness:

  • a title prefix tree that constrains beam search to valid Wikipedia titles, and
  • a (language, title) → Wikidata QID lookup for offline QID resolution.

Both are mmap-loaded at startup, so cold start is seconds regardless of file size (the legacy pickle path took ~57 min).

Files

File Size Format Role
titles_lang_all105_marisa_trie_with_redirect.marisa ~600 MB marisa_trie.Trie (native .save/.mmap) Prefix tree of valid Title >> lang token-id sequences (105 languages, redirects included). Drives constrained beam search via a prefix_allowed_tokens_fn callback.
lang_title2wikidataID-normalized_with_redirect.marisa ~200 MB marisa_trie.BytesTrie Maps f"{lang}\x1f{title}" → the lex-smallest Wikidata QID (ASCII). Resolves generated titles to QIDs offline.

Each holds ~89 million keys. all105 = the 105 languages of the underlying mBART-50 / mGENRE vocabulary.

Provenance & construction

These files are converted, byte-faithfully, from Facebook Research's GENRE public downloads at https://dl.fbaipublicfiles.com/GENRE/:

  • titles_lang_all105_marisa_trie_with_redirect.pkl (~582 MB) — a pickled GENRE MarisaTrie wrapper. Conversion extracts the inner marisa_trie.Trie and re-saves it as a bare native binary so it can be mmap-ed directly.
  • lang_title2wikidataID-normalized_with_redirect.pkl (~3.9 GB) — a dict[(lang, title), str | set[QID]]. Conversion streams it into a marisa_trie.BytesTrie, collapsing multi-QID values to the lex-smallest QID at build time (so the runtime does a single trie lookup instead of an ~8-minute normalisation pass per launch).

The conversion is performed by the impresso-nel-stage-assets tool in impresso-inference (src/impresso_inference/tasks/nel/stage_assets.py). Nothing about the entity inventory is added or removed — this is a format/packaging re-host of the GENRE data for fast startup.

Intended use

Pair with impresso-project/nel-mgenre-multilingual (mGENRE, an mBART-50 sequence-to-sequence entity linker). mGENRE emits strings of the form "Wikipedia_Title >> xx":

  • The trie restricts generation to valid titles at every decoder step (prevents hallucinated pages).
  • The lookup turns the generated (title, lang) into a Wikidata QID without any live Wikipedia/Wikidata HTTP calls — suitable for offline / batch inference.

In impresso-inference, the NEL task auto-downloads whichever file is missing from this dataset on first launch. See that repo's src/impresso_inference/tasks/nel/ for the full pipeline.

How to load

import marisa_trie

# Title trie — constrained decoding
trie = marisa_trie.Trie()
trie.mmap("titles_lang_all105_marisa_trie_with_redirect.marisa")

# (lang, title) -> QID lookup
lookup = marisa_trie.BytesTrie()
lookup.mmap("lang_title2wikidataID-normalized_with_redirect.marisa")
qid = lookup[f"en\x1fGermany"][0].decode("ascii")   # -> "Q183"

Token-id encoding (trie only). marisa-trie stores keys as UTF-8 strings, so mGENRE token ids are encoded per character as chr(t) for t < 55000 and chr(t + 10000) otherwise — a 10 000-codepoint shift that skips the UTF-16 surrogate range. This matches the upstream GENRE byte layout; any consumer of the trie must apply the same shift when decoding allowed-token sets. Keys are Title >> lang token sequences.

Licensing

Released under CC BY-NC 4.0 (non-commercial), inherited from the upstream facebookresearch/GENRE data these files are derived from. The underlying knowledge base is public: Wikidata identifiers are CC0, and Wikipedia titles are CC BY-SA. Use for non-commercial research consistent with the GENRE license.

Citation

The trie and lookup originate from mGENRE:

@article{de-cao-etal-2022-multilingual,
  title   = "Multilingual Autoregressive Entity Linking",
  author  = "De Cao, Nicola and Wu, Ledell and Popat, Kashyap and Artetxe, Mikel
             and Goyal, Naman and Plekhanov, Mikhail and Zettlemoyer, Luke and
             Cancedda, Nicola and Riedel, Sebastian and Petroni, Fabio",
  journal = "Transactions of the Association for Computational Linguistics",
  volume  = "10",
  year    = "2022",
  address = "Cambridge, MA",
  publisher = "MIT Press",
  url     = "https://aclanthology.org/2022.tacl-1.16",
  doi     = "10.1162/tacl_a_00460",
  pages   = "274--290"
}

Acknowledgements

Repackaged for historical-newspaper entity linking by the Impresso project — an interdisciplinary effort on historical media analysis across languages, time, and modalities. Funded by the Swiss National Science Foundation (CRSII5_173719, CRSII5_213585) and the Luxembourg National Research Fund (grant No. 17498891).

Downloads last month
-