Skip to content

One-command launchers for Linux and Windows, retrieve-twice by default, and GPU results at 1.5B/4B/24B - #11

Merged
FMXExpress merged 17 commits into
mainfrom
claude/optimistic-allen-i3bd3d
Nov 7, 2026
Merged

FMXExpress merged 17 commits into
mainfrom
claude/optimistic-allen-i3bd3d

Conversation

@FMXExpress

Copy link
Copy Markdown
Owner

This PR adds one-command launchers for Linux and Windows and turns on retrieve-twice by default. It also changes defaults based on today's GPU results, and adds the benchmarks and results behind them. It follows #10; these commits came after that merge.

One-command launchers

Each launcher detects CPU cores, RAM and NVIDIA GPUs and picks a preset. It installs only what is missing, writes run/<preset>.ini, and starts memagent. Both work from a clone and from an extracted release.

  • Linux: scripts/run.sh.
  • Windows: scripts/run.cmd / run.ps1, written for Windows PowerShell 5.1. The installer adds a "memagent (best settings for this PC)" Start menu entry.
Preset Picked when Model Background training
cpu-lite under 4 cores or 8 GB RAM SmolLM2-135M 1 core
cpu no GPU Qwen2.5-1.5B off (/sleep on demand)
gpu8 one 8–11 GB GPU Qwen2.5-1.5B off (/sleep on demand)
gpu12 one 12–39 GB GPU Qwen3-4B same GPU
gpu40 one 40 GB+ GPU Magistral-Small 24B same GPU
2gpu two GPUs 24B / 4B / 1.5B by VRAM GPU 1

When llama.cpp has no CUDA, GPU presets answer through the Python engine. That covers the Windows release and machines without nvcc. On Windows the launcher installs PyTorch with CUDA, since pip's default there is CPU-only.

Default changes, each backed by a measurement

  • [retrieval] hops=2 (retrieve twice). Each name in the first hits gets a second retrieval (Mem.Recall.RecallHops). In the 1.5B agent, bridge questions had both facts in the prompt 100% of the time instead of 12.5%. The score went from 40/96 to 58/96.
  • Large profile trains 2 epochs at lr 2e-4. The old 8 epochs at 5e-4 learned every fact but drifted ×16, so the gate would have rejected every deep sleep. The new settings drift 1.04, with recall still 1.00.
  • Medium gate allows drift up to 1.5. Its best run scored 77/96, the top score of the day, and drifted 1.39.
  • The agent warns after two rejected training runs in a row. It says whether drift or recall failed and what to change in models.json.
  • The 1.5B presets do not train in the background. In the agent, the GPU-trained 1.5B memory scored 32/96 against 58/96 for retrieval.

Results (details in bench/README.md)

Python benchmark on an RTX A6000: bench/bench_integration_hf.py, with the same retrieved facts at every model size.

Model Retrieval Retrieval + deep sleep Bridge, retrieval → + sleep
1.5B 63/96 54/96 4 → 18
4B 69/96 77/96 4 → 20
24B 72/96 62/96 (gentle settings) 3 → 23

The trained memory combines facts with retrieval: retrieval supplies "your sister is Hana", and the weights know Hana's city. But it also teaches a format: yes/no questions get answered with fact sentences. Varied question formats in the training data are the next fix and aren't in this PR.

Fact editing: trainer/edit_facts.py writes facts with MEMIT and saves them as a LoRA. It is fast, at 7–12 minutes, and barely changes the model, with drift 1.01–1.02. Recall is 0.83 at 1.5B and 0.94 at 4B. It does not help combine facts. It also fixes a bug where the attention sink at position 0 made every person's key look alike.

Testing

  • make test: extraction 710/710, priors 39/39, retrieval, HTTPS, and Python unit tests all pass.
  • run.sh: a real start here (the cpu preset) stored two facts and answered a two-fact question. Dry runs pass in a clone, a mock release folder and a real scripts/package.sh tarball.
  • run.ps1 / run.cmd: not run in this session, because the sandbox does not allow installing PowerShell. release.yml now dry-runs both on the Windows runner for this PR, under Windows PowerShell 5.1. The checks: preset choice, the Python engine for GPU presets in the release, and no files written.
  • Not verified: VRAM fit for the 8 GB and 12 GB presets (only the 24B was measured, at about 43 GB peak), two-GPU operation, and hours of continuous background training.

Generated by Claude Code

claude added 17 commits November 6, 2026 21:36
…s with a second retrieval

A question that needs two linked facts ("Which city does my brother live in?"
needs "Your brother's name is Yusuf" and "Yusuf's city is Ghent") shares words
with only one of them; one hop put both in the prompt for 3 of 24 such
questions. RecallHops queries "<name> <question>" for each name in the top
rag_k facts (HopSeed: the value of a my-fact, the owner of a named one) and puts
the best new fact that mentions the name after the fact that named it, at most
hop_k (default rag_k) more. Off by default until the benchmark says otherwise.
bench_integration.py --hops N.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
…ts; retrieve twice by default; gentler 24B training; warn when the gate keeps rejecting

scripts/run.sh detects cores, RAM and NVIDIA GPUs, picks a preset (cpu-lite,
cpu, gpu8, gpu12, gpu40, 2gpu), builds memagent and llama.cpp (CUDA when there
is a GPU and nvcc) and installs the Python trainer only when missing, writes
run/<preset>.ini and starts memagent with background training on.

- [retrieval] hops=2 by default: 40 -> 58 of 96 integration questions (1.5B)
- large profile: 2 epochs at lr 2e-4 (8 at 5e-4 drifted x16, so every deep
  sleep would have been rejected); medium gate allows drift 1.5 (its best run,
  77/96 and the top score, drifted 1.39)
- after two rejected runs in a row the agent says why (drift or recall) and
  what to change, instead of burning compute silently
- bench/README.md: edited facts, GPU deep sleep at 1.5B/4B/24B, retrieve
  twice, and what the presets rest on

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
…are dry-run in CI; no background training at 1.5B

- scripts/run.ps1 + run.cmd: the same presets as run.sh for Windows
  PowerShell 5.1. In a release folder (next to memagent.exe) or a clone. The
  Windows llama.cpp is CPU-only, so GPU presets answer through the Python
  engine; it installs PyTorch with CUDA (pip's default on Windows is CPU-only),
  the trainer and bitsandbytes when missing, and writes the ini without a BOM.
- run.sh also works in an extracted release, and falls back to the Python
  engine on a GPU without a CUDA llama.cpp. --dry-run writes nothing.
- Releases: run.sh in the Linux tarball; run.cmd/run.ps1 in the Windows zip and
  installer, with a "memagent (best settings for this PC)" Start menu entry.
  release.yml dry-runs each launcher in its release folder on every PR.
- cpu and gpu8 presets (1.5B) set [consolidate] auto=0: in the agent with two
  hops, the GPU-trained 1.5B memory scored 32/96 against 58/96 for retrieval.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
@FMXExpress
FMXExpress merged commit c18ebec into main Nov 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants