Repository navigation
Memory tiers (fast LoRA on a frozen deep one), varied training examples, AVX2 release builds - #6
Merged
Merged
Conversation
…es, AVX2 portable builds - Tiers ([consolidate] tiers=auto): a fast LoRA retrains on the facts since the last deep sleep whenever the trainer is free, on top of the frozen deep LoRA, with a replay sample of deep facts; a deep sleep rebuilds the deep LoRA from every fact once the fast one holds deep_after facts, or a fact was forgotten or changed. Training waits between windows while a turn is answered. /nap, /sleep (cancels a run in progress), /wait until caught up. - llama.cpp patch: llama_lora_train_init_adapter trains one adapter while the other attached adapters stay frozen; graph budget per attached adapter. - Mem.Examples: templates (as before) or varied examples per fact (short and full answers, reverse questions, yes/no checks with another fact's value, fill in the blank, two facts together); ported to trainer/memlib.py. - bench_memory.py --trainer llama with build/bench_llama: trains and answers with the in-process trainer and engine; --set overrides training settings. - LLAMA_PORTABLE builds (and the Windows release) now enable AVX2/FMA/F16C: GGML_NATIVE=OFF alone compiled ggml for plain SSE, several times slower. - scripts/e2e_tiers.sh (make test-tiers). Benchmark runs B-D (varied examples) still in progress. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
… use another llama.cpp build Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
… budget (E) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
Run C of the varied-examples benchmark (bench/README.md): LoRA accuracy 0.75 -> 0.93, interference 0.083 -> 0.05, drift 1.49 (gate 3.0). Confabulation is unchanged within noise; the guard still handles it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two memory tiers
With the in-process trainer (
[consolidate] tiers=auto, the default), long-term memory has two LoRAs applied together:deep_after(8) facts, or a fact was forgotten or changed (at most everyinterval_min), or/sleep; rebuilt from the base model as before, then the fast LoRA empties/nap: start a fast run now./sleep: start a deep sleep, cancelling a run in progress./wait: wait until memory has caught up, including follow-up runs./statusand/adapter: show both tiers.llama_lora_train_init_adapter, which trains one adapter while the other attached adapters stay frozen, and sizes the graph budget per attached adapter.TLlamaChat.GenerateWithapplies several adapters.TEnginegetsLoadFastAdapter/ClearFastAdapter/FastAdapter.TMemStoregetsApplyFastManifestandFastTierCount.fast-<ts>, and/rollbackonly goes back to deep (mem-) ones.Varied training examples
Mem.Examples(ported tomemlib.varied_qas) can turn each fact into several kinds of example instead of one answer string:This follows Hatakeyama-Sato et al. 2023 and O'Neill et al. 2026.
tinynow uses varied examples, 12 per fact, with adapters onv_proj, o_proj, gate_proj, up_proj(details inbench/README.md).Benchmark harness
bench_memory.py --trainer llama [--set key=value]trains and answers through the newbuild/bench_llama, which uses the in-process trainer and engine, so the benchmark measures what the agent ships.Release builds were plain SSE
LLAMA_PORTABLE=1, and the Windows release cmake call, setGGML_NATIVE=OFFbut never enabled AVX2. ggml was therefore built for baseline x86-64, several times slower; 3 facts × 1 epoch took 357 s. Portable builds now enable AVX/AVX2/FMA/F16C/BMI2, which covers Haswell (2013) and later. The v0.2.0 binaries have the slow build.Tests
make test: pass.scripts/e2e_tiers.sh(make test-tiers, new): pass.MEMAGENT_ENGINE=llama scripts/e2e_demo.sh: pass with tiers on, covering supersede,/forgetand/rollbackthrough the tiers.Generated by Claude Code