When an LLM says "Einstein invented the telephone," can you explain why that's wrong and who actually did?
This system provides interpretable knowledge grounding with explicit reasoning chains. Every association has a type (SCOPE, HISTORY, KNOWN_FOR) and a weight - auditable and correctable.
LLMs encode world knowledge in opaque parameters. When they hallucinate, we observe the output is wrong but can't explain why.
| Approach | Detects Errors | Explains Why | Provides Correction |
|---|---|---|---|
| LLM Confidence | Unreliable | No | No |
| Embedding Similarity | Sometimes | No | No |
| RAG Retrieval | Sometimes | Partial | Sometimes |
| This System | Yes | Yes | Yes |
from wiki_grounding import EntityStore, SpreadingActivation
store = EntityStore("data/entities_demo.db")
einstein = store.search("Albert Einstein")[0]
anchors = store.get_entity_anchors(einstein.entity.id)
for anchor_id, label, category, weight in anchors[:5]:
print(f" {category}: {label} (weight: {weight:.2f})")
# Output:
# SCOPE: Physics (1.00)
# SCOPE: Philosophy (1.00)
# SCOPE: Quantum mechanics (1.00)
# KNOWN_FOR: Relativity (0.70)Einstein → Physics is an explicit SCOPE anchor with weight 1.0. No "telephone" anchor exists.
spreader = SpreadingActivation(store)
activated = spreader.spread(einstein.entity.id, use_anchors=True)
for result in activated[:3]:
print(f" {result.entity.entity.label}: {result.activation:.3f}")
# History of philosophy: 0.648 via anchor:Philosophy
# Game theory: 0.420 via anchor:PhilosophyThe activation path is visible. Compare to embeddings where cosine_sim(Einstein, Philosophy) = 0.7 tells you nothing about why.
| Table | Count |
|---|---|
| Entities | 10,082 |
| Entity Links | 38,941 |
| Anchor Dictionary | 15,433 |
| Entity-Anchor Links | 202,052 |
Wikipedia vital articles (levels 1-4) with typed semantic connections.
| Operation | Latency |
|---|---|
| Links only | ~20ms |
| With anchor layer | ~76ms |
The anchor layer adds latency but provides typed connectivity - you know why entities are connected.
git clone https://github.com/rohan-vinaik/sparse-wiki-grounding
cd sparse-wiki-grounding
pip install -e .
PYTHONPATH=src python examples/explore_entity.py "Marie Curie"When an LLM claims "Einstein invented the telephone":
- Look up Einstein's anchors → no "telephone" or "invention" anchor
- Look up telephone's anchors → find "Alexander Graham Bell"
- Provide correction with evidence
The explanation is the data structure itself.
- Collins & Loftus (1975): Spreading activation in semantic memory
- Ranganathan: Multi-dimensional faceted classification
- Wierzbicka: Semantic primitives and decomposition
MIT License