Skip to content

About

Governed memory for local models: facts fold into the weights, answer with an empty context, and revoke exactly.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Assay

Memory for local models that folds into the weights — and revokes exactly.

A model learns a fact. Afterwards it answers from an empty context: no retrieval, no notes, nothing in the prompt. Then you revoke the source, and it can't answer any more — with the base weights numerically restored.

[1] before learning — empty context
    Q: Who won her first WTA Tour title at the 2026 Washington DC Open?
    A: The answer is Elena Rybakina.          ← wrong; the model has never seen this
    knows it? False

[2] teaching it (folding into weights)
    {'source': 'tennis-feed', 'artifact': 'assay_state/delta_0_tennis-feed.npz', 'ledger_size': 1}

[3] after learning — still an EMPTY context, no retrieval
    A: Alexandra Eala.
    knows it? True
    base drift now: {'max_abs': 0.1526, 'relative': 0.0158}

[4] revoking the source
    {'revoked': 'tennis-feed', 'base_restored_numerically': True,
     'residual': {'max_abs': 4.8e-07, 'relative': 4.9e-08}}

[5] after revocation
    A: The answer is Elena Rybakina.          ← the original answer, exactly
    knows it? False

That is real output from examples/01_remember_and_revoke.py.

This is one layer, not the whole system

Assay is a governed continual-learning stack: memory, consolidation, routing, a self-assessment probe, a gated self-improvement loop, and revocation. This repository is the memory and revocation layer only — roughly three of those parts. Consolidating a fact into weights and removing it exactly is what you get here. Capability installation, routing, the confidence probe, the promotion gate, and the successor loop are not included. The measured results from the wider program are linked below and clearly marked where they go beyond this code.

Why this is different from RAG

Retrieval puts facts in the prompt — you pay for them on every query, and "forgetting" means deleting a row and hoping nothing else absorbed it. Assay puts them in the weights, then makes removal an operation you can measure: every change is a ledgered artifact, and revoking one subtracts exactly the delta that was added.

Install

git clone https://github.com/arsenis-cmd/assay && cd assay
pip install -e .
python examples/01_remember_and_revoke.py

Requires Apple Silicon. This is built on MLX and runs on M-series Macs only. A CUDA port is not done. Say so before you plan around it.

First run downloads Qwen3-4B (~7.5 GB). Consolidating one fact takes ~2–4 minutes on an M4 Max.

Use

from assay import Assay

a = Assay()                                     # frozen base model, nothing modified
a.ask("Who won the 2026 Washington DC Open?")   # → doesn't know

a.remember(
    statement="Alexandra Eala won her first WTA Tour title at the Washington DC Open in August 2026.",
    question="Who won her first WTA Tour title at the 2026 Washington DC Open?",
    answer="Alexandra Eala",
    source="tennis-feed",
)
a.consolidate(source="tennis-feed")             # folds into weights, under an anti-forgetting constraint
a.ask("Who won the 2026 Washington DC Open?")   # → knows it, empty context

a.revoke("tennis-feed")                         # exact removal
a.base_residual()                               # → {'max_abs': 4.8e-07, 'relative': 4.9e-08}

Results from the research program behind this

property measured the bound, stated
Recall with empty context 32 post-cutoff facts consolidated and answerable with no retrieval held-out paraphrase recall erodes from 0.83 toward 0.53–0.67 as the store grows
Accumulation without forgetting 23/23 consolidations alive across 5 generations, vs 3/11 unconstrained plasticity declines as the protected set grows (acceptance 6→3)
Revocation revoke one source → its 8 facts die, the other 21 stay at 1.00 numerically exact, not bit-identical: fuse-then-unfuse leaves ~7e-09 residual (below float32 epsilon)
Cost vs retrieval 1.00 vs ~0.10 accuracy at ~30× fewer tokens on a real repository one task, one repo — not a general benchmark

Which of these this package reproduces: rows 1 and 3. examples/01_remember_and_revoke.py runs the empty-context recall and the revocation residual end to end on your own machine. Row 2 (accumulation across generations) uses the constraint that ships here but comes from a longer campaign the example does not run. Row 4 does not come from this code at all — the retrieval comparison uses a separate read path that is not part of this release. Do not read that number as a property of what you just installed.

Revoking an item in the middle of the ledger invalidates everything consolidated after it, so that path replays the survivors rather than subtracting once.

What this is not

  • Not a CUDA library. Apple Silicon only, today.
  • Not a general capability upgrade. Consolidation adds knowledge; it does not make the model smarter.
  • Not a benchmark-beating model. The point is the governance of what it learns.
  • Not production-hardened. This is research code made runnable, at lab scale, on one machine.

The research behind it

Every claim above traces to a preregistered campaign with pass/fail committed before the run, adversarial controls, and failures kept in the record: assay-research.

Licence

Apache 2.0.

About

Governed memory for local models: facts fold into the weights, answer with an empty context, and revoke exactly.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages