ykolo's picture
Upload dataset
a62e7fb verified
|
Raw
History Blame Contribute Delete
8.86 kB
metadata
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: 5721
        num_examples: 35
    download_size: 20503
    dataset_size: 5721
  - config_name: entities
    features:
      - name: id
        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: 'null'
      - name: text
        dtype: string
      - name: abstract
        dtype: string
      - name: page_id
        dtype: int64
      - name: n_characters
        dtype: int64
      - name: pile_count
        dtype: int64
    splits:
      - name: train
        num_bytes: 97175
        num_examples: 38
    download_size: 235417
    dataset_size: 97175
  - 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: 104109
        num_examples: 53
    download_size: 74255
    dataset_size: 104109
  - config_name: spans
    features:
      - name: id
        dtype: int64
      - name: document_id
        dtype: string
      - name: entity_id
        dtype: string
      - name: alias
        dtype: string
      - name: boundaries
        list:
          list: int64
      - name: wikipedia_url
        dtype: string
    splits:
      - name: train
        num_bytes: 13267
        num_examples: 88
    download_size: 11889
    dataset_size: 13267
  - 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: 12848
    dataset_size: 4766
  - config_name: triples
    features:
      - name: id
        dtype: int64
      - name: relation_id
        dtype: string
      - name: relation_name
        dtype: string
      - name: prompt
        dtype: string
      - name: subject
        dtype: string
      - name: subject_qid
        dtype: string
      - name: object
        dtype: string
      - name: object_qid
        dtype: 'null'
    splits:
      - name: train
        num_bytes: 1237660
        num_examples: 9696
    download_size: 482568
    dataset_size: 1237660
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: spans
    data_files:
      - split: train
        path: spans/train-*
  - config_name: templates
    data_files:
      - split: train
        path: templates/train-*
  - config_name: triples
    data_files:
      - split: train
        path: triples/train-*

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 the Wikidata API (labels / aliases / properties).

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)
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

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_identity_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
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[] (best-first ⇒ 0)
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 the Wikidata API; abstract/text from structured-wikipedia; disambiguation pages filtered out;
  • triples: linearity relations; relation_id is the Wikidata P-id from a static mapping; template is the best prompt per relation (max partial-match in generation).
  • links: ZELDA entity-linking documents; mention wikipedia_id matched to entities.page_id → QID.

Code: https://github.com/siemovit/platovec