Skip to main content

SMA-1: Structure-Mapping Agentic Memory — a structure-mapping retrieval memory that grounds language models in curated ontologies

Project description

SMA-1: Structure-Mapping Agentic Memory

CI License: Apache-2.0 HF Space

Structure-mapping memory grounds language models in curated ontologies. SMA is a retrieval memory that grounds a generalist LLM in a curated, expert-maintained ontology, retrieving by logical structure — subsumption (is-a) and higher-order relations — that vector RAG and knowledge graphs discard. Holding the language model and prompt fixed and swapping only the memory, the SMA-grounded agent becomes more accurate, more selective, and more structurally attributable than vector RAG: it cites its evidence structurally, abstains when nothing grounds the case, and flags novelty — capabilities flat retrievers structurally lack. On the real-domain benchmarks the measured advantage is carried by bounded is-a subsumption plus information-content weighting (the higher-order relational machinery is decisive only on a synthetic structure-only control), and it vanishes where no discriminative ontology applies.

SMA process tour

A structure-mapping memory over a curated ontology grounds a generalist LLM by the subsumption hierarchy and rarity weighting that flat retrievers wash out — and the structural alignment itself is what survives when there is no surface signal at all.


What it does

Capability SMA Vector RAG Knowledge graph
Rare / long-tail retrieval (rarity-weighted) ✗ averages rarity away
Cross-vocabulary / zero-lexical-overlap match partial
Subsumption (is-a) reasoning ✗ no ascension
Structural citation (checkable provenance) partial
Calibrated abstention ✗ cosine always "high"
Novelty / expectation-violation flag partial

One universal loader ingests any open OBO/OWL/STIX/CPC ontology (is-a hierarchy plus typed relations, no OWL reasoning); a registry + domain router select across domains. We mount eleven ontologies spanning seven knowledge areas (≈594,000 concepts) behind one shared retrieval core plus thin per-domain data adapters.

SMA system overview

Headline results (honest)

On a memory-swap benchmark where only the retriever varies, SMA beats a strong RAG + KG baseline suite on the rare/long-tail slice across five domains:

Domain SMA tail top-5 best RAG Δ Holm-significant
Medicine (HPO/MONDO) 0.949 0.606 +0.333 yes
Finance (US-GAAP) 0.418 0.231 +0.167 yes
Genomics (GO) 0.849 0.682 +0.156 yes
Legal (CPC, all-query) 0.941 0.870 +0.064 yes
Cyber (ATT&CK) 0.766 0.749 +0.073 directional*

* Cyber survives Holm across domains but not a conservative Bonferroni-over-baselines selection correction (p=0.035 → 0.17); reported as directional. End to end (medicine, LLM-in-the-loop), the SMA-grounded agent is the most accurate (0.342 vs dense 0.100 vs closed-book 0.017), most faithful in citation, and uniquely separates known from unknown entities (grounding AUROC 0.79 vs vector RAG's near-chance 0.55).

Where it does not help (reported, not hidden): SMA ties a bespoke ontology information-content oracle (Phenomizer) rather than beating it; and on flat single-record tabular prediction (hospital readmission, credit-card fraud, the Elliptic Bitcoin graph-fraud probe) there is no discriminative subsumption ontology to mount, so SMA reaches only parity and a flat logistic-regression baseline wins. The advantage is specific to structure.

How it works

SMA architecture

  1. Adapter — a universal loader parses any open ontology into a normalized graph, mounts the is-a hierarchy as an ascension lattice (specific terms match general ones with penalty ρ^dist) and the typed relations as higher-order cases, and registers them behind a per-query domain router.
  2. Matcher — a case (functors over a subject) is screened by a certified MAC admissible-content bound, aligned by best-first structure-mapping (FAC/SME), and scored by a rarity-weighted information-content (−log₂ p) surprisal scorer.
  3. Decision — the alignment yields a structural citation, a calibrated abstention, or a novelty flag (SAGE expectation violation).

Quick start

python -m venv .venv && . .venv/bin/activate
pip install -e ".[encoders,eval]"
pytest -m "gate_G0 or gate_G1 or gate_G2 or gate_G3 or gate_G4 or gate_G5 or gate_G6"
sma ui                       # FastAPI + Gradio demo

Raw datasets are not tracked. Fetch checksum-verified external data with:

python scripts/fetch_datasets.py --manifest data/manifests/datasets.json

Reproduce the confirmatory tables/figures from committed CSVs:

python scripts/figures_paper.py      # main-text figures
python scripts/figures_ed.py         # Extended Data figures

All result numbers in the paper trace to reports/confirmatory/*.csv; runs are deterministic (PYTHONHASHSEED=0, paired bootstrap seeded at 12345).

Repository layout

Path Contents
sma/ontology/ universal ontology adapter (loaders, mount, registry, router) — frozen adapter-v1
sma/eval/agentic/ memory-swap retrieval harness + baseline arms
sma/eval/agentic_qa/ end-to-end LLM-QA agent (pre-registration v2)
scripts/ dataset fetch, figure/table generators, ablations
reports/confirmatory/ all result CSVs (every paper number sources here)
paper/manuscript/ sma_nature_mi.tex — the manuscript (Nature sn-jnl template)
release/ model card, dataset card, HuggingFace Space

Paper & citation

The manuscript (paper/manuscript/sma_nature_mi.tex, intended for Nature Machine Intelligence) is built on the official Springer Nature sn-jnl template. To cite this software, see CITATION.cff.

License

Apache-2.0. All mounted ontologies are openly licensed and version-pinned; we redistribute only derived gold labels, never restricted source records (see Extended Data and release/model_card.md).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

structuremappingmemory-1.0.0.tar.gz (183.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

structuremappingmemory-1.0.0-py3-none-any.whl (209.9 kB view details)

Uploaded Python 3

File details

Details for the file structuremappingmemory-1.0.0.tar.gz.

File metadata

  • Download URL: structuremappingmemory-1.0.0.tar.gz
  • Upload date:
  • Size: 183.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for structuremappingmemory-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1c1eb3155233408599b727fb3ff4e0f2407422b436b6265b65061b089d2f3dcb
MD5 44e1faaac75d982d57e34c9b19fc2acc
BLAKE2b-256 ad5292a956ace51708229833f4562d4e3608a3e74ea3f010d49ad743a643e023

See more details on using hashes here.

Provenance

The following attestation bundles were made for structuremappingmemory-1.0.0.tar.gz:

Publisher: publish.yml on ayazkhan27/SMA-1

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file structuremappingmemory-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for structuremappingmemory-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bff30b86e2374068c0a724bcaa462beec6b7fc88beafad532faef9275ef751e3
MD5 9c3284433774e29e9175d12a193610c0
BLAKE2b-256 cf413d6976188c0fee5b28a4864f6e417a970b2488f195f896981eec07bfec64

See more details on using hashes here.

Provenance

The following attestation bundles were made for structuremappingmemory-1.0.0-py3-none-any.whl:

Publisher: publish.yml on ayazkhan27/SMA-1

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page