| --- |
| configs: |
| - config_name: documents |
| data_files: |
| - split: train |
| path: documents/train-* |
| - config_name: entities |
| data_files: |
| - split: train |
| path: entities/train-* |
| - config_name: links |
| data_files: |
| - split: test |
| path: links/test-* |
| - config_name: templates |
| data_files: |
| - split: train |
| path: templates/train-* |
| - config_name: triples |
| data_files: |
| - split: train |
| path: triples/train-* |
| dataset_info: |
| - config_name: documents |
| features: |
| - name: document_id |
| dtype: string |
| - name: entity_ids |
| list: string |
| - name: aliases |
| list: string |
| - name: index |
| list: |
| list: int64 |
| - name: entity_count |
| dtype: int64 |
| splits: |
| - name: train |
| num_bytes: 20248546 |
| num_examples: 21845 |
| download_size: 18353071 |
| dataset_size: 20248546 |
| - config_name: entities |
| features: |
| - name: qid |
| dtype: string |
| - name: label |
| dtype: string |
| - name: description |
| dtype: string |
| - name: alias |
| list: string |
| - name: wikidata_url |
| dtype: string |
| - name: wikipedia_url |
| dtype: string |
| - name: what_links_here |
| list: string |
| - name: properties |
| list: |
| - name: property_id |
| dtype: string |
| - name: value |
| dtype: string |
| - name: text |
| dtype: string |
| - name: abstract |
| dtype: string |
| - name: page_id |
| dtype: int64 |
| - name: n_characters |
| dtype: int64 |
| - name: origin |
| list: string |
| - name: n_mentions |
| dtype: int64 |
| - name: pile_count |
| dtype: int64 |
| - name: n_triples |
| dtype: int64 |
| - name: n_tokens_pythia |
| dtype: int64 |
| - name: n_tokens_llama |
| dtype: int64 |
| splits: |
| - name: train |
| num_bytes: 200105053 |
| num_examples: 21970 |
| download_size: 137035367 |
| dataset_size: 200105053 |
| - config_name: links |
| features: |
| - name: source |
| dtype: string |
| - name: document_id |
| dtype: 'null' |
| - name: entity_ids |
| list: string |
| - name: index |
| list: |
| list: int64 |
| - name: text |
| dtype: string |
| - name: wikipedia_ids |
| list: int64 |
| - name: wikipedia_titles |
| list: string |
| splits: |
| - name: test |
| num_bytes: 5597904 |
| num_examples: 4765 |
| download_size: 3878170 |
| dataset_size: 5597904 |
| - config_name: templates |
| features: |
| - name: relation_id |
| dtype: string |
| - name: relation_name |
| dtype: string |
| - name: templates |
| list: string |
| splits: |
| - name: train |
| num_bytes: 4766 |
| num_examples: 26 |
| download_size: 6424 |
| dataset_size: 4766 |
| - config_name: triples |
| features: |
| - name: id |
| dtype: int64 |
| - name: relation_id |
| dtype: string |
| - name: relation_name |
| dtype: string |
| - name: template |
| dtype: string |
| - name: template_id |
| dtype: int64 |
| - name: subject |
| dtype: string |
| - name: subject_qid |
| dtype: string |
| - name: object |
| dtype: string |
| - name: object_qid |
| dtype: string |
| splits: |
| - name: train |
| num_bytes: 1309505 |
| num_examples: 9696 |
| download_size: 329450 |
| dataset_size: 1309505 |
| --- |
| # platovec — Wikipedia entities, documents, linearity triples & ZELDA links |
|
|
| A dataset for studying **entity representations in LLMs**: how |
| entities are encoded, how those representations form, and their causal effects. |
|
|
| Built from a seed entity list (the factual relations of Hernandez et al. 2024, by title, plus |
| ZELDA mention targets, by Wikipedia page id) by joining **`wikimedia/structured-wikipedia`** |
| (text + links) and **Wikidata** — labels / aliases / properties from either the Wikidata API or a |
| local `.json.bz2` dump. |
|
|
| ## Configs |
|
|
| | config | granularity | description | |
| |---|---|---| |
| | `entities` | one row / entity | the entity, its text, abstract, aliases, properties, links | |
| | `documents` | one row / document | mention positions of entities within a document | |
| | `triples` | one row / linearity fact | (subject, object) + chosen template + QIDs + Wikidata property | |
| | `templates` | one row / relation | candidate prompt templates per relation (best-first) | |
| | `links` | one row / ZELDA document | entity-linking mentions for retrieval eval (split `test`) | |
|
|
| ```python |
| from datasets import load_dataset |
| entities = load_dataset("ykolo/entityconcepts", "entities", split="train") |
| documents = load_dataset("ykolo/entityconcepts", "documents", split="train") |
| triples = load_dataset("ykolo/entityconcepts", "triples", split="train") |
| links = load_dataset("ykolo/entityconcepts", "links", split="test") |
| ``` |
|
|
| ## `entities` |
|
|
| | column | type | description | |
| |---|---|---| |
| | `qid` | str | Wikidata QID (row key) | |
| | `label` | str | entity name (Wikipedia article title) | |
| | `description` | str | one-line description | |
| | `alias` | list[str] | alternative names (Wikidata "also known as", English) | |
| | `wikidata_url` | str | | |
| | `wikipedia_url` | str | | |
| | `what_links_here` | list[str] | QIDs of seed entities whose article links to this one | |
| | `properties` | list[{property_id, value}] | Wikidata claims (value = QID for items, rendered text otherwise) | |
| | `text` | str | flat article text (reconstructed from structured-wikipedia sections) | |
| | `abstract` | str \| null | article lead/abstract (from structured-wikipedia) | |
| | `page_id` | int \| null | English Wikipedia page id (structured-wikipedia `identifier`) | |
| | `n_characters` | int \| null | article length (structured-wikipedia `version.number_of_characters`) | |
| | `origin` | list[str] | seed origin(s): `linearity` and/or `zelda` | |
| | `n_mentions` | int | total mention occurrences across the `documents` table | |
| | `pile_count` | int \| null | frequency of the label in the Pile (if provided) | |
| | `n_triples` | int | number of `triples` where this entity is the subject | |
| | `n_tokens_pythia` | int \| null | tokens of `label` under the Pythia (GPT-NeoX) tokenizer | |
| | `n_tokens_llama` | int \| null | tokens of `label` under the Llama-3.x tokenizer | |
|
|
| ## `documents` |
|
|
| One row = one document (an entity's Wikipedia article). Lists are aligned by position: |
| `entity_ids[i]` ↔ `aliases[i]` ↔ `index[i]`. The document text is `entities[document_id].text` |
| (not duplicated here). Use it to extract an entity's activations at its mention positions |
| across several documents (self-mention ⇔ `document_id` ∈ `entity_ids`). |
|
|
| | column | type | description | |
| |---|---|---| |
| | `document_id` | str | QID of the entity whose article is this document (→ `entities.qid`) | |
| | `entity_ids` | list[str] | QID of each mentioned entity (repeats for multiple mentions) | |
| | `aliases` | list[str] | surface form found in the text for each mention (hyperlink anchor for cross-page mentions; matched label/alias for self-mentions) | |
| | `index` | list[[int, int]] | character [start, end] offsets in the document's text | |
| | `entity_count` | int | number of **distinct** entities mentioned in the document | |
|
|
| ## `triples` |
|
|
| Facts from the factual linearity relations (one row per (subject, object) sample). |
|
|
| | column | type | description | |
| |---|---|---| |
| | `id` | int | | |
| | `relation_id` | str \| null | mapped Wikidata property, e.g. `P36` (null if unmapped) | |
| | `relation_name` | str | human-readable name, e.g. "country capital city" | |
| | `template` | str | prompt template with `{}` as the subject placeholder | |
| | `template_id` | int \| null | index of the template used in `templates.templates[]` (0 = relation best; may differ per triple with per-triple selection) | |
| | `subject`| str | subject | |
| | `subject_qid` | str\|null | qid of subject | |
| | `object`| str | object | |
| | `object_qid` | str\|null | qid of object | |
|
|
| ## `links` |
|
|
| Entity-linking documents from the **ZELDA** dataset, for retrieval evaluation. One row = one |
| document; each mention's ZELDA `wikipedia_id` is matched to the `page_id` column of `entities` |
| to recover its QID. Split `test` (the `source` column gives the ZELDA subset, e.g. `aida-b`; |
| `train` is available too if built). Lists aligned by position: |
| `entity_ids[i]` ↔ `index[i]` ↔ `wikipedia_ids[i]` ↔ `wikipedia_titles[i]`. |
|
|
| | column | type | description | |
| |---|---|---| |
| | `source` | str | split origin (`train`, or test set name e.g. `aida-b`) | |
| | `document_id` | str \| null | QID of the document's own Wikipedia page (train only; via `entities.page_id`) | |
| | `entity_ids` | list[str] | QID of each mention's gold entity | |
| | `index` | list[[int, int]] | character [start, end] offsets in `text` | |
| | `text` | str | document text | |
| | `wikipedia_ids` | list[int] | raw ZELDA Wikipedia page ids of the mentions (traceability) | |
| | `wikipedia_titles` | list[str] | ZELDA Wikipedia titles of the mentions (traceability) | |
|
|
| Mentions whose `wikipedia_id` is not present in `entities` (entity not scraped) are dropped (logged). |
|
|
| ## Construction |
|
|
| - **seed entities**: subjects + objects of the factual relations (by title) + ZELDA mention |
| targets (by `page_id`). `origin` records which source(s) each entity came from. |
| - **`entities` / `documents`**: text + link graph from hugging face `wikimedia/structured-wikipedia` |
| (enwiki); aliases & properties from Wikidata (API or local dump); `abstract`/`text` from |
| structured-wikipedia; disambiguation pages filtered out. Mentions: an entity in its **own** page |
| is found by matching its label + aliases; mentions in **other** pages come from **hyperlink |
| anchors** (exact surface form + offset) by default, which avoids false positives (e.g. matching |
| "Paris" inside *Notre-Dame de Paris*). |
| - **`triples`**: linearity relations; `relation_id` is the Wikidata P-id from a static mapping. |
| `template` is the best prompt — either per relation (max partial-match in generation) or, with |
| per-triple selection, the candidate that maximises the gold object's teacher-forced log-prob for |
| that specific (subject, object). |
| - **`links`**: ZELDA entity-linking documents; mention `wikipedia_id` matched to `entities.page_id` → QID. |
|
|
| Code: https://github.com/siemovit/platovec |
|
|