Module: logit_staircase.py @version 1.3.0 @date 2026-11-01 Another collaboration between Andrew.human and Claude.ai
| Version | Date | Change | ||
|---|---|---|---|---|
| 1.0.0 | 2026-10-31 | First release. Ran on the Clone (staircase_20261031-154509). |
||
| 1.1.0 | 2026-11-01 | Step-by-step mode: --gate N, --follow LEVEL, --stepwise. Default behaviour unchanged. Its 24-step self-test failed on the Clone at step 12 (a near-tie), so it never ran. |
||
| 1.1.1 | 2026-11-01 | Step-by-step mode now makes its own no-push baseline (baseline_stepwise.json) and compares against that. A difference from the original baseline is accepted only at a near-tie (--tie-gap, default 0.3), otherwise it stops. Mode printed on the console. --selftest-steps removed. Tested against a stand-in server only. |
||
| 1.2.0 | 2026-11-01 | New "repeated 4-word runs" measure (catches sentence loops that "longest repeat" misses; baseline reference is in the table). A biased first piece inside an already completed phrase is no longer a stray (new count "inside"). Summary table gains one column. Checked offline against the real v1.1.1 logs and end to end on the stand-in server. | ||
| 1.3.0 | 2026-11-01 | New --mid LO-HI: at every step, whatever the model ranks LO to HI gets the level bonus (candidates or not). One group, mid. Stand-in server test only. |
||
| 1.3.0 | 2026-11-01 | New --mid LO-HI: at every step, whatever the model ranks LO to HI (not mem-toks) gets the level bonus. Special tokens (`< |
... | >`, e.g. end of text) are never pushed and end the reply. Tested on the stand-in server only. |
It asks LLM2 (Qwen3-4B on port 8082) the standard prompt again and again, each time pushing up the score of the first token of every mem-tok candidate by a fixed amount (+1, +2 ... +6). It also does the same with a control list of unrelated words. For each push it compares the reply with the no-bias baseline and reports where the reply first changed and how much damage was done. The question it answers: how big a push does the model tolerate before the reply breaks, and is the damage specific to mem-toks or happens to any word?
Everything runs at temperature 0, so a given setting always gives the same reply.
standard_prompt.txt, memtok_candidates.txt, qwen_llm2_std_120a.json (the verified no-bias baseline, temperature 0, 50 top probabilities, at least 120 steps). control_words.txt is found in the current folder or next to the script.First look at the plan, generating nothing:
python3 logit_staircase.py --dry-run
Then the full run (6 levels x 2 groups = 12 runs, about 13 minutes if the prompt is cached; the first run may take about 150 s if not):
python3 logit_staircase.py
Options: --stepwise, --gate, --follow, --tie-gap (see Step-by-step mode below), --server, --prompt, --candidates, --control, --baseline, --levels 1,2,3,4,5,6, --groups mem,control (also mem_in = candidates already in the prompt, mem_new = candidates not in the prompt), --n 120, --nprobs 50, --flag-steps 20, --include-flagged, --dry-run, --outdir, --wait 120, --timeout 900.
The output folder name is new every run (default staircase_YYYYMMDD-HHMMSS) and an existing folder is refused. Ctrl-C stops cleanly and writes a partial summary marked PARTIAL (exit 130).
plan.md - candidates, first-token ids, groups, flagged tokens.run_<group>_L<level>.json and .txt - compact log of each run (the .txt starts with "temperature 0").summary.md and summary.json - the tables to read first.--include-flagged.Why: a fixed push lands on the same word piece at every step, and it only ever touches the first piece of a phrase (v1.0.0 result: first words leaked, no phrase completed). The server cannot make a push depend on what was just chosen, so this mode asks for ONE token at a time, sending the prompt as token ids plus everything chosen so far, and sets the push fresh at every step.
--follow LEVEL - once the first k pieces of a candidate have been chosen, push piece k+1 by LEVEL for the next step. This is what can pull a whole phrase through. Example: --levels 3 --follow 8.--gate N - push a first piece (by the run's level) only on steps where it is already ranked N or better in an unpushed probe of that step. Costs one extra request on steps where something qualifies. Example: --levels 3,4,5 --gate 10.--stepwise - step-by-step with neither of the above (a check that it matches the normal mode).run_<group>_g<gate>_f<follow>_L<level>.baseline_stepwise.json. Every step-by-step run is compared with that file, not with the original baseline, because generating one token per request rounds slightly differently from one long request and can flip a near-tie (seen on the Clone: step 12, gap 0.12). The new baseline is checked against the original: identical is fine; a difference where the original's two best scores were closer than --tie-gap (0.3) is reported as rounding; a difference anywhere else stops the run (token-id prompt does not reproduce the text prompt). A probe request then finds whether scores are reported before the push.--follow 8, no gate, mem only): +2 reads naturally and completes "relative and absolute risk"; +3 and +4 hijack at step 4 ("false positives") and loop (repeated 4-word runs 55% / 25% against 23% for the baseline). Next test: add --gate 10.mean shift is not meaningful.Examples:
python3 logit_staircase.py --dry-run --gate 10 --follow 8
python3 logit_staircase.py --groups mem --levels 2,3,4 --follow 8
python3 logit_staircase.py --groups mem,control --levels 2,3,4 --gate 10 --follow 8
python3 logit_staircase.py --mid 3-15 --levels 1,2,3
At every step the harness asks the server for the scores with no push, takes the tokens ranked LO to HI (3rd to 15th here; the model's favourites 1-2 and the long tail are left alone; special tokens such as end-of-reply are skipped), and pushes all of them by the level. Then it takes the step. Reads: how the reply drifts when tokens the model finds "somewhat interesting" are promoted. Each run is one reply per level; read the .txt files.
The blunt version of the experiment: forget the mem-tok list and, at every step, push the tokens the model ranks LO to HI (the "fair to middling" ones, plausible but not leading) by the level. Shows how far and how fast replies bend when plausible-but-not-leading words are favoured, whatever they are.
python3 logit_staircase.py --mid 4-30 --levels 1,2,3
python3 logit_staircase.py --mid 3-15 --levels 1,2,3,4
run_mid_mid<LO>-<HI>_L<level>. Compare replies against baseline_stepwise.json. Forced/completed counts are zero by design (no candidates); read the reply text, "first differing step", "distinct-word ratio" and "repeated 4-word runs".--follow does nothing here (no candidates).--dry-run first and check the plan.