Repository navigation
Releases: fulvian/engraft-ngram
Release list
ENGRAFT v0.2.2 — one hundred facts, one 9 MB file
Second public release. v0.1.0 wrote eight facts, one trigger each. This one writes a small world: one hundred facts about an invented character (Quail), learned from sentences that use them, and recalled by the real llama.cpp engine on sentences it never saw.
What changed since v0.1.0
- Usage-corpus descent. The variables are the 14,032 table rows read by the corpus; the loss is a language-model loss on the answers plus a KL term on everything else. The result is one 9 MB
.pleooverlay. No weight is touched, and removing the file gives the base model back bit for bit. - Numbers, real engine, free routing, 841 held-out test sentences: exact answer 0.841 with the overlay, 0.005 without. Second seed 0.873. Collateral damage on neutral text: mean KL 0.0131. Every figure in the README is recomputed from the file named next to it (
scripts/check_readme_numbers.py, 39 checks). - Three languages (English and Chinese preliminary, one seed each): 0.841 / 0.797 / 0.676. The ordering follows training mass per fact, not language.
- Row sharing, measured. Facts about the same subject share rows by content, not by hash collision; of the 37 failures lost to a sibling of the same subject, 21 went to the sibling with more training mass.
- Try it. A working one-command demo with token ids, and next to it a sentence that fails, on purpose.
What this is, and what it is not. Token-addressed memory: zero context tokens, no retriever, one removable file. It is not general model editing and not a retrieval rival; the head-to-head against retrieval over the same corpus has not been run, and the README says so.
Known weak spots, stated rather than hidden
- The composition probes (10 / 83) were evaluated with a 40-token budget that truncates every generation. The number is kept, flagged, and being re-measured.
- The v0.2.1 tag shipped a demo sentence that was one of the 134 failures. A reader found it; the fix and the reader's failing sentence are both in the README now.
- Open items are listed in
docs/history.md: retrieval baseline, clean composition probes, a disjoint-row arm, LoRA and ROME/MEMIT comparisons.
Thanks to the readers who read the code instead of the headline and reported what they found. Keep doing that.
How this was built: code, experiments and write-up were produced in Claude Code sessions (Anthropic's Claude) driven by a single human operator who set the goals, approved every design step, ran the hardware and read every result.
ENGRAFT v0.1.0 — first public release
First public release of ENGRAFT (ENgram GRadient Routing-Aware Fact Transplant): add a fact to Qwen3.8-Flash-Next by gradient descent on the 8 trigram-keyed rows of its n-gram (Engram/PLE) table, through a CPU replica of the frozen model with expert routing refreshed at every step, shipped as an overlay the engine substitutes at read time.
What is in this release:
- the code (Apache 2.0), an offline quick start against fakes, and
scripts/reproduce.shfor the real model; - the run of record
results/2026-09-05/: 7 of 8 facts reproduced by the real llama.cpp engine at first-token probability 0.85 to 0.96, merged overlay identical to single overlays, sister triggers unchanged, CPU replica equal to the full-precision engine on 17 of 17 grafts; - the technical report
paper/engraft.pdf(CC BY 4.0), attached below.
Limitations are stated in the README and in the report: the grafts do not generalize to the fact stated inside a document, one counterfactual fact with a concentrated base-model prior does not take, one model and one run of eight facts.
How this was built: the code, the experiments and the write-up were produced in a Claude Code session (Anthropic's Claude, model Fable 5.1) driven by a single human operator who set the goals, approved every design step, ran the hardware and read every result. We want the method checked, broken and improved.