Handoff: WereRAT/Tessa step-31500 inference checkpoint for llama.cpp integration #8

Closed
opened 2026-11-18 17:45:51 +00:00 by dsh · 1 comment
Member

Goal. Validate that the llama.cpp WereRAT path loads and runs a real HIJACK/Tesseract checkpoint (complex RAT trunk + hijacked tied embedding/head), and report what conversion/parity work is needed.

Artifact (mid-training base, not SFT'd Tessa).

  • models/wereat/tessa-step31500-infer.pt (292 MB, gitignored)
    • inference-only: model_state_dict, hijack_config, teacher metadata, step; no optimizer state
  • models/wereat/tessa-demo-step31500.json (PyTorch sample generations)
  • models/wereat/README.md (handoff notes)
  • a short pointer note is in input/2026-11-18-wereat-tessa-checkpoint.md; the weight itself is in models/ because the input-box README excludes checkpoints

Model config. 9 layers, n_embd=768 complex (level 1), n_head=48, block_size=2048, adapter=real (free bridge, latent 1536 -> d 576). Teacher interface: SmolLM2-135M tied E/H (vocab 49,152, d=576), out_norm, same tokenizer.

PyTorch reference loader. hijack.niah.load_wereat_checkpoint in ml-lab/hijack (loads config, teacher, bridges, WereRAT, state dict; releases teacher forward weights).

Checks requested.

  1. Load/convert the checkpoint in the llama.cpp RAT path (complex weights + hijacked embedding/head).
  2. Logits parity vs the PyTorch loader on fixed prompts (documented tolerance).
  3. Greedy generation smoke test; compare against tessa-demo-step31500.json qualitatively.
  4. Report throughput/memory on CPU and (if available) GPU; note any kernel/format limitations.

Context. This is a ~130M-token checkpoint from the ml-lab/hijack 100M-effective-RAT run (WSD 1.5B declared, raw-FineWeb mix). It is good enough for integration; the final Tessa SFT checkpoint comes later. Conversion/quantization tracking lives in ml-lab/tesseract issue #4.

If it works, we get an early end-to-end llama.cpp/WereRAT pipeline and a Tesseract Chat target; if not, the blockers feed #4 before the app work.

**Goal.** Validate that the llama.cpp WereRAT path loads and runs a real HIJACK/Tesseract checkpoint (complex RAT trunk + hijacked tied embedding/head), and report what conversion/parity work is needed. **Artifact (mid-training base, not SFT'd Tessa).** - `models/wereat/tessa-step31500-infer.pt` (292 MB, gitignored) - inference-only: `model_state_dict`, `hijack_config`, teacher metadata, `step`; **no optimizer state** - `models/wereat/tessa-demo-step31500.json` (PyTorch sample generations) - `models/wereat/README.md` (handoff notes) - a short pointer note is in `input/2026-11-18-wereat-tessa-checkpoint.md`; the weight itself is in `models/` because the input-box README excludes checkpoints **Model config.** 9 layers, `n_embd=768` complex (level 1), `n_head=48`, `block_size=2048`, `adapter=real` (free bridge, latent 1536 -> d 576). Teacher interface: **SmolLM2-135M** tied `E`/`H` (vocab 49,152, d=576), `out_norm`, same tokenizer. **PyTorch reference loader.** `hijack.niah.load_wereat_checkpoint` in `ml-lab/hijack` (loads config, teacher, bridges, WereRAT, state dict; releases teacher forward weights). **Checks requested.** 1. Load/convert the checkpoint in the llama.cpp RAT path (complex weights + hijacked embedding/head). 2. Logits parity vs the PyTorch loader on fixed prompts (documented tolerance). 3. Greedy generation smoke test; compare against `tessa-demo-step31500.json` qualitatively. 4. Report throughput/memory on CPU and (if available) GPU; note any kernel/format limitations. **Context.** This is a ~130M-token checkpoint from the `ml-lab/hijack` 100M-effective-RAT run (WSD 1.5B declared, raw-FineWeb mix). It is good enough for integration; the final Tessa SFT checkpoint comes later. Conversion/quantization tracking lives in `ml-lab/tesseract` issue #4. **If it works**, we get an early end-to-end llama.cpp/WereRAT pipeline and a Tesseract Chat target; if not, the blockers feed #4 before the app work.
Author
Member

Works end to end — tesseract arch is implemented and the step-31500 checkpoint is verified. Commit 7640d9ee0 (docs: devops/wereat.md).

What was built

  • LLM_ARCH_TESSERACT reuses llama_model_tardits: the trunk is a plain level-1 complex RAT (768, 9L, 48 heads, block 2048) in the existing split-plane layout. The frozen SmolLM2-135M E (49152×576, f32; also reused for the tied head) and a real bridge pair (in_proj 576→1536 + bias, out_proj 1536→576, no bias) are explicit GGUF tensors. loss.target=post_norm → tardits.head_norm=false, so the teacher out_norm is not applied.
  • tardits2gguf/convert_wereat.py: loads the hijack checkpoint + teacher E (HF cache), writes arch tesseract, SmolLM2 BPE tokenizer → 402 MB f32 GGUF (models/wereat/tessa-step31500.gguf).
  • tardits2gguf/tools/check_wereat.py: rebuilds the PyTorch reference without importing hijack (tardits RAT + bridges), generates step-recurrence goldens and runs the C++ harness (tardits_parity_ids).

Parity (goldens = RAT.step recurrence, i.e. the same math as ggml_tardits_scan)

prompt T max_abs argmax
"Tessa says:" 4 2.384e-05 476 = 476
"The most important thing about human conversation is" 8 1.907e-05 260 = 260
"Once upon a time" 4 1.907e-05 28 = 28
long combined prompt 49 2.575e-05 198 = 198

4/4 PASS. Scan-vs-step drift on the same prompts is 3.681e-04 / 7.210e-04 / 7.029e-04 / 1.885e-02 at T=49 — the known de Moivre drift (LinA #23), which is why the runtime uses the exact recurrence. Tolerance 1e-4 documented in the tool.

Tokenizer / generation

  • llama-tokenize on the tesseract GGUF: Tessa says: hello world → [68, 39226, 1921, 42, 33662, 905], identical to the HF SmolLM2 tokenizer (BPE, pre=smollm).
  • Generation smoke test is coherent English; e.g. -p "Tessa says:" -n 60 --temp 0.8: "I want to get more work than I can to go out and do it. We are going to take some time for our projects...". The demo JSON was sampled by the PyTorch generator with different sampler settings, so compare qualitatively — token-level parity above is the hard check.

Throughput / memory (CPU, t14; no GPU visible)

  • load 135 ms (mmap), max RSS 458 MB, short-prompt prefill ~98 tok/s, generation ~31 tok/s at default threads.
  • GPU note: ggml_tardits_scan / ggml_cd_mul are CPU-only ops; a CUDA build would keep the trunk scan on CPU (bridge matmuls + tied head are standard ops). GPU numbers need the CUDA build on a GPU box.

Limits / follow-ups

  • f32 first (402 MB), no quantization yet — tracked in ml-lab/tesseract#4.
  • n_seqs = 1 (recurrent state); chunked long-context carry not yet parity-tested beyond 49 tokens (state-based, should work; can add a 1k+ case).
  • test-llama-archs skips tesseract until a synthetic fixture exists (same as TARDITS; part of #7).
  • Final SFT Tessa: the converter should handle it unchanged if trunk shape + bridge config stay the same; if SFT switches head_norm/adapter, the runtime path exists for head_norm but the reference tool needs that branch.
  • Fork patch surface: arch enum + 2 bridge tensor enums + explicit string-key get_key<> instantiations in src/llama-model-loader.cpp.

Existing suites unchanged: tardits parity 20/20 PASS, test-llama-archs 151/151 (tesseract skipped), llama-completion/llama-tokenize work on the new GGUF.

Closing this handoff as validated. Ping when the SFT checkpoint lands (or if you want the q8/llama-server smoke test before that).

**Works end to end — `tesseract` arch is implemented and the step-31500 checkpoint is verified.** Commit `7640d9ee0` (docs: `devops/wereat.md`). ### What was built - `LLM_ARCH_TESSERACT` reuses `llama_model_tardits`: the trunk is a plain level-1 complex RAT (768, 9L, 48 heads, block 2048) in the existing split-plane layout. The frozen SmolLM2-135M `E` (49152×576, f32; also reused for the tied head) and a real bridge pair (`in_proj` 576→1536 + bias, `out_proj` 1536→576, no bias) are explicit GGUF tensors. `loss.target=post_norm` → `tardits.head_norm=false`, so the teacher `out_norm` is not applied. - `tardits2gguf/convert_wereat.py`: loads the hijack checkpoint + teacher `E` (HF cache), writes arch `tesseract`, SmolLM2 BPE tokenizer → **402 MB f32 GGUF** (`models/wereat/tessa-step31500.gguf`). - `tardits2gguf/tools/check_wereat.py`: rebuilds the PyTorch reference without importing `hijack` (tardits RAT + bridges), generates **step-recurrence** goldens and runs the C++ harness (`tardits_parity_ids`). ### Parity (goldens = `RAT.step` recurrence, i.e. the same math as `ggml_tardits_scan`) | prompt | T | max_abs | argmax | |---|---|---|---| | "Tessa says:" | 4 | 2.384e-05 | 476 = 476 | | "The most important thing about human conversation is" | 8 | 1.907e-05 | 260 = 260 | | "Once upon a time" | 4 | 1.907e-05 | 28 = 28 | | long combined prompt | 49 | 2.575e-05 | 198 = 198 | **4/4 PASS.** Scan-vs-step drift on the same prompts is 3.681e-04 / 7.210e-04 / 7.029e-04 / **1.885e-02** at T=49 — the known de Moivre drift (LinA #23), which is why the runtime uses the exact recurrence. Tolerance 1e-4 documented in the tool. ### Tokenizer / generation - `llama-tokenize` on the `tesseract` GGUF: `Tessa says: hello world` → `[68, 39226, 1921, 42, 33662, 905]`, identical to the HF SmolLM2 tokenizer (BPE, pre=smollm). - Generation smoke test is coherent English; e.g. `-p "Tessa says:" -n 60 --temp 0.8`: `"I want to get more work than I can to go out and do it. We are going to take some time for our projects..."`. The demo JSON was sampled by the PyTorch generator with different sampler settings, so compare qualitatively — token-level parity above is the hard check. ### Throughput / memory (CPU, t14; no GPU visible) - load 135 ms (mmap), max RSS **458 MB**, short-prompt prefill ~98 tok/s, generation **~31 tok/s** at default threads. - GPU note: `ggml_tardits_scan` / `ggml_cd_mul` are CPU-only ops; a CUDA build would keep the trunk scan on CPU (bridge matmuls + tied head are standard ops). GPU numbers need the CUDA build on a GPU box. ### Limits / follow-ups - f32 first (402 MB), no quantization yet — tracked in `ml-lab/tesseract#4`. - `n_seqs = 1` (recurrent state); chunked long-context carry not yet parity-tested beyond 49 tokens (state-based, should work; can add a 1k+ case). - `test-llama-archs` skips `tesseract` until a synthetic fixture exists (same as TARDITS; part of #7). - Final SFT Tessa: the converter should handle it unchanged if trunk shape + bridge config stay the same; if SFT switches `head_norm`/adapter, the runtime path exists for `head_norm` but the reference tool needs that branch. - Fork patch surface: arch enum + 2 bridge tensor enums + explicit string-key `get_key<>` instantiations in `src/llama-model-loader.cpp`. Existing suites unchanged: `tardits` parity **20/20 PASS**, `test-llama-archs` 151/151 (tesseract skipped), `llama-completion`/`llama-tokenize` work on the new GGUF. Closing this handoff as validated. Ping when the SFT checkpoint lands (or if you want the q8/llama-server smoke test before that).
dsh closed this issue 2026-11-18 18:20:21 +00:00
Sign in to join this conversation.
No description provided.