demo: apply gpt-5.5 review -- float-C fix, trim comments, soften overclaims

External review (docs/reviews/code_demo.md) triaged scout-mindset:
- FIX float-C crash: C={C:+g} not {:+d} (steering coeffs are floats)
- ACCEPT trim: shorter demo.py/config/fit docstrings (user also flagged verbosity)
- ACCEPT soften "fit J where we steer" -> "closer to the chat distribution" (most
  fitted positions are user/doc tokens, not assistant <think>; run-524 went further)
- ACCEPT soften "what the model thinks" -> "lens readout (linear approx)"
- ADD seed to show_steer so per-C blocks are comparable under sampling
- REJECT "</think> stripped by skip_special_tokens" -- verified false: decode keeps
  think tags (they're added, not registered-special tokens), split_think works

Co-Authored-By: Claudypoo <288921227+claudypoo@users.noreply.github.com>
This commit is contained in:
wassname
2026-07-10 15:02:42 +08:00
co-authored by Claudypoo
parent 57a0276ae6
commit 69d7d2f1d9
8 changed files with 65 additions and 79 deletions
+5 -5
View File
@@ -1,11 +1,11 @@
"""Fit and cache any HF causal LM's Jacobian for the notebooks and README. (Claude)
Pass `--model`; the cache lands at `config.cache_path(model)` (e.g.
`artifacts/qwen3.5-4b.jac`). Prompts are jlens's WikiText-103 corpus wrapped in
the model's chat template (config.chat_corpus): we fit J at the chat operating
point where steering is applied, matching the verified run-524. jlens guidance:
~100 prompts is usable, the paper uses 1000; 128 is a cheap default. Idempotent:
re-running loads the existing cache instead of refitting (Jacobian.fit_cached).
`artifacts/qwen3.5-4b.jac`). Prompts are jlens's WikiText-103 wrapped in the
chat template (config.chat_corpus), closer to the distribution the model steers
in than raw documents. jlens guidance: ~100 prompts is usable, the paper uses
1000; 128 is a cheap default. Idempotent: re-running loads the existing cache
instead of refitting (Jacobian.fit_cached).
uv run python scripts/fit.py --model Qwen/Qwen3.5-4B
uv run python scripts/fit.py --model Qwen/Qwen3-0.6B --dim-batch 8