Repository navigation
State safety: pin the KV and GDN pools for matrix runs and record allocated pools - #102
Conversation
run_matrix.py now starts every server with --max-running-requests 8, --max-total-tokens 49152 and --max-mamba-cache-size 40, and restarts it until the pools it allocates (read from the server log) are exactly those sizes. Before each start it waits until enough GPU memory is free (68 GB for MTP, 52 GB for plain, or GPU_STARTUP_MIN_FREE_GB). Pinned runs go to ~/vp-data/state/runs_pinned, and each run's meta records the pin and the resolved pools. --no-pin restores the earlier unpinned runs.
compare.py reads the pools each server allocated (from its log for runs that predate the record) into run_meta.json, and noise_floor.csv gains a pools_identical column. The two fresh-server repeat rows had different pools (97,672 vs 133,885 KV tokens, 122 vs 167 GDN slots), and the evidence README now says so; the pinned rerun is queued.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
analyze_all.sh writes pools.json: for each noise-floor pair, tapped mechanism run, tap check and tap signature, the pools each server allocated and whether they match. Only single-server comparisons had identical pools. The evidence README flags every comparison across servers with its pools and states what the difference can and cannot explain: KV provenance would first show at a full-attention layer.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f3748f397
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| raise SystemExit(f'bad pass name {p!r}') | ||
|
|
||
| pin = not args.no_pin | ||
| root = Path(args.out_dir or Path.home() / 'vp-data/state' / ('runs_pinned' if pin else 'runs')) |
There was a problem hiding this comment.
Point analysis at the pinned run directory
With the default invocation used by run_all.sh, this now writes every new matrix result under ~/vp-data/state/runs_pinned, but analyze_all.sh and compare.py still read ~/vp-data/state/runs. Consequently, running the documented collection and analysis workflow silently regenerates evidence from the old unpinned data rather than the newly collected pinned runs. Update the analysis inputs/defaults alongside this output-directory change.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 5784971. analyze_all.sh now also analyses ~/vp-data/state/runs_pinned with pairs_pinned.json, writing the *_pinned evidence files, and keeps the unpinned runs/ analysis in the unsuffixed files. compare.py and cycles.py take the root as a required --runs, so neither can fall back to the old directory. Once runs_pinned/ exists, any pair with a missing run makes compare.py --require-all exit non-zero and stops the script (STATE_ALLOW_MISSING=1 allows a partial regeneration), and missing pairs are recorded in the output JSON.
|
Verdict: REQUEST CHANGES Reviewed head 258f9ff (65a4012, f1f7b00, 7f3748f, 258f9ff). What checks out
BlockingB1 (Codex P1, B2 (integrator check 3): the MTP draft-KV caveat is missing. For plain vs MTP, the README rules out pools because "a different copy of a shared prefix's KV would first show at a full-attention layer's output, and every first difference is at layer 0's GDN recurrence". That covers the target's KV. MTP's draft layer has its own attention over cached KV, and with the radix cache on, a request can read a different copy of the draft's prefix KV. That changes draft proposals, then acceptance lengths, then the verify passes' shapes. The verify shape changes the target's layer-0 GDN arithmetic without any target attention output differing first. State this route, and that the pool difference (84,003 / 55 against 166,522 / 97 for the MTP tap sessions; 159,322 / 199 against 166,522 / 97 for v3 plain against v3 MTP) is therefore not ruled out for the MTP comparisons by the first-difference location. |
analyze_all.sh analyses runs_pinned/ with pairs_pinned.json (cap 8 labels) into *_pinned evidence files, next to the unpinned runs/ analysis. compare.py and cycles.py now require --runs, so neither falls back to the old root. Once runs_pinned/ exists, a missing pinned run fails the script unless STATE_ALLOW_MISSING=1, and compare.py records missing pairs. The evidence README no longer says the first-difference location rules out the pools for plain vs MTP. MTP's draft layer reads its own cached prefix KV, so a different copy can change proposals, accept lengths and later verify forwards without any target attention output differing first. The location bounds only the first difference, at the first row of the first verify forward.
|
Verdict: APPROVE Re-reviewed 5784971. B1 is fixed.
B2 is fixed.
Checks.
Integrator checks (1)–(3) are now all met. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 57849713ac
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pin = not args.no_pin | ||
| root = Path(args.out_dir or Path.home() / 'vp-data/state' / ('runs_pinned' if pin else 'runs')) |
There was a problem hiding this comment.
Keep the tuned equality campaign on one pool regime
When bench/campaigns/equality_tuned.sh invokes this runner with a custom output directory, it does not pass --no-pin, while its reference plain directory is explicitly linked from the legacy unpinned ~/vp-data/state/runs/plain. Consequently, every newly collected missing arm is now pinned at cap 8 and compared against the old dynamically sized cap-16 reference, reintroducing the pool-size confound this change is intended to eliminate and potentially corrupting the campaign's equality conclusions. Update that campaign to use the pinned reference or explicitly request the legacy unpinned behavior.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 221e6c8. bench/campaigns/equality_tuned.sh now passes --no-pin to run_matrix.py. Its reference is state's unpinned runs/plain, so the arms it collects stay in that same regime (cap 16, pools sized from free memory) instead of being pinned at cap 8 against an unpinned reference. Moving the campaign to the pinned reference (runs_pinned/plain) is bench's call once that run lands; I've told bench.
There was a problem hiding this comment.
Further in 0ac8751: mixing pool regimes now fails instead of passing silently. run_matrix.py refuses to write into an output root that already holds runs of the other regime, including linked reference directories such as the campaign's plain link, and compare.py refuses any pair of a pinned and an unpinned run. --allow-mixed-pins overrides either refusal and keeps the flag in the output (pinned_a/pinned_b per pair, mixed_pin_pairs). Checked on the bench equality root: with --no-pin no runs clash; with the pin default all 9 sessions are reported and the run is refused. Bench is keeping --no-pin. Its committed pairs compared servers with different KV pools (c=1, radix cache off in every arm); bench now records each server's pools in pools.csv.
bench/campaigns/equality_tuned.sh compares new arms against state's unpinned runs/plain reference, so it now passes --no-pin and its arms keep the same regime (cap 16, pools sized from free memory) rather than becoming pinned at cap 8 against an unpinned reference. Also show --runs in the cycles.py usage.
run_matrix.py refuses to write into a root that already holds runs of the other regime (linked reference directories included), and compare.py refuses a pair of a pinned and an unpinned run. --allow-mixed-pins overrides both. compare.py records pinned_a/pinned_b per pair and the mixed pairs.
|
Verdict: APPROVE Re-reviewed 0ac8751 (221e6c8, 0ac8751, and the main merge 813c152).
My approval at 5784971 on the analysis path and the MTP draft-KV caveat carries to this head. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0ac87518a9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if la == lb: | ||
| s['pools_identical'] = True |
There was a problem hiding this comment.
Derive server identity from per-pass metadata
When passes for one session are collected in separate invocations—for example, plain/c1 first and plain/c32 later—run_matrix.py starts a new server and overwrites the session's single server.log, but both runs still produce the same la/lb path here. The comparator therefore reports pools_identical: true even for unpinned servers that allocated different pools, corrupting the provenance of resumed or incrementally collected experiments. Compare the pool values recorded in each pass's metadata rather than treating a shared directory as proof of a shared server.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 1b85947. Server identity now comes from each pass. New runs record a per-process server_id and the allocated pools in every pass's meta (server.launch). For older runs, compare.pass_server uses the session's server.log only if the pass's started_at lies inside that log's first-to-last timestamp span, which means that server ran it; otherwise the server and pools are unknown. A shared directory is no longer treated as proof of a shared server. noise_floor.csv gains a same_server column, and pools.json uses the same per-pass logic for matrix runs. The existing evidence is unchanged: every same-directory pair's passes fall inside one server's log span.
| elif la.exists() and lb.exists(): | ||
| s['pools_identical'] = resolved_pools(la) == resolved_pools(lb) |
There was a problem hiding this comment.
Treat unresolved pool fields as unknown
When both server logs exist but one of the allocation patterns is absent—for example after an incomplete log write or a future SGLang log-format change—resolved_pools() returns None for that field in both dictionaries, so dictionary equality marks the pools identical. This silently converts missing evidence into a positive equality result; require every resolved value to be non-None before comparing, otherwise report pools_identical as unknown.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 1b85947. server.pools_known() requires every resolved field to be non-None. compare.pools_match and the pools.json step report pools_identical as None (unknown) when either side has a missing field, instead of comparing two dicts of None. There is a test for this case.
…nknown A shared session directory no longer counts as a shared server. New runs record a server id and the allocated pools in every pass's meta. For older runs the session's server.log, which each new server overwrites, is used only for passes that started inside that log's time span. A pool field missing from the log makes pools_identical unknown (None) instead of equal. noise_floor.csv gains same_server, and both CSVs now quote fields, since pair labels contain commas.
|
Verdict: APPROVE Re-reviewed 1b85947, which fixes Codex's two P2s on 0ac8751.
|
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b85947427
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| la, lb = dir_a / 'server.log', dir_b / 'server.log' | ||
| pa = resolved_pools(la) if la.exists() else None | ||
| pb = resolved_pools(lb) if lb.exists() else None | ||
| a, b = str(dir_a.relative_to(root)), str(dir_b.relative_to(root)) |
There was a problem hiding this comment.
Resolve mechanism sessions against the current data root
When analyze_all.sh runs under a home directory other than /home/ubuntu, the committed mechanism summaries still contain absolute paths such as /home/ubuntu/vp-data/state/tap/v3_plain_c1, while root is $HOME/vp-data/state. This relative_to(root) call then raises ValueError, so evidence regeneration stops before writing pools.json. Rebase the stored session names onto the current root/tap directory or handle paths outside the current root.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 0f96d71. The pools record moved into experiments/state_safety/pools.py, and analyze_all.sh now calls it. pools.data_relative() rebases data paths onto the current root. A path under the current ~/vp-data/state, or a relative one, is kept. An absolute path from another home directory is cut at its .../vp-data/state/ segment, and anything else raises with a clear message. The committed /home/ubuntu/... mechanism summaries therefore resolve under any HOME. mechanism.py now writes a, b and untapped_run relative to the data root. tests/test_state_safety_server.py::test_pools_record_regenerates_under_another_home sets HOME to a temporary directory and builds the record from a summary naming /home/ubuntu paths. The regenerated pools.json is byte-identical.
The pools record moves into pools.py. It maps data paths recorded under another home directory (the committed mechanism summaries name /home/ubuntu/vp-data/state/tap/...) onto the current ~/vp-data/state, so regeneration no longer fails under a different HOME. mechanism.py now writes its run paths relative to the data root. A test builds the record under a different HOME. pools.json is unchanged.
|
Verdict: APPROVE Re-reviewed 0f96d71, which fixes Codex's P2 on 1b85947 (committed absolute
Codex has not run on 0f96d71. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0f96d713c4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if args.require_all and missing: | ||
| raise SystemExit(f'{len(missing)} pairs have missing runs under {root}: {missing}') |
There was a problem hiding this comment.
Validate required pairs before overwriting evidence
When runs_pinned/ exists but collection is incomplete, the default analyze_all.sh invocation supplies --require-all, yet this check runs only after noise_floor_pinned.json, both CSVs, and run_meta_pinned.json have already been replaced with partial results. The command exits nonzero as intended, but the committed evidence is nevertheless left truncated and can be consumed or committed later; perform this validation before writing outputs, or write temporary files and publish them only after validation succeeds.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 5c3f1d2. compare.py now runs the missing-run check (--require-all) and the mixed-regime check before it loads or writes anything. A refused regeneration exits before touching noise_floor_pinned.json, the CSVs or run_meta_pinned.json, so the previous complete outputs stay in place. tests/test_state_safety_server.py::test_compare_refuses_before_writing_any_output checks that an existing output is unchanged and that no CSV is created.
compare.py now checks for missing runs (with --require-all) and mixed pool regimes before it writes anything, so a refused regeneration leaves the previous evidence files intact instead of replacing them with partial results. A test checks that a refused run leaves an existing output unchanged.
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Verdict: APPROVE Re-reviewed 5c3f1d2, which fixes Codex's P2 on 0f96d71. No evidence file changes. The state tests pass (27), and pre-commit passes. Codex finished on 5c3f1d2 with no comments. Keeping the new |
Appendix D: qualify cross-server comparisons by their pools (#102); status-table intro
Pins the KV and GDN pools for the state-safety matrix runs, per the BRIEF rule "Equality comparisons pin the pools". Also records the pools every existing run allocated.
What changes
server.py:POOL_PINsets--max-running-requests 8,--max-total-tokens 49152and--max-mamba-cache-size 40._calculate_mamba_ratio).resolved_pools()reads the sizes the server actually allocated from its log.launch_with_retry(expect_pools=...)restarts a server whose pools differ from the pin. Its last attempt raises instead of running unpinned.startup_lock(min_free=...)followsGPU_STARTUP_MIN_FREE_GBsemantics. It waits until enough memory is free: 68 GB for MTP, 52 GB for plain, which is 4 x (weights + pinned pools) at--mem-fraction-static 0.25.run_matrix.py:--max-total-tokens 6000still wins.~/vp-data/state/runs_pinnedand recordspool_pinin each run's meta.--no-pinreproduces the earlier runs (cap 16, pools from free memory) in~/vp-data/state/runs.compare.py:run_meta.jsonnow hasresolved_poolsfor every run. For older runs they come from the server log.noise_floor.csvgains apools_identicalcolumn.Queue
All my queued holds were resubmitted at their original arrivals (
GPU_LOCK_ARRIVAL). The matrix runs pick up the pins when they start, and a pinned rerun of the plain baseline (c1, c32, the warm passes and a second fresh session) shares the MTP matrix's arrival.Checks
tests/test_state_safety_server.py): pin override, log parsing, and the free-memory wait. 13 state-safety tests pass in total.analyze_all.shregenerates the evidence. The only changes are the new pool fields and column.Provenance of the existing comparisons (258f9ff)
evidence/state_safety/pools.jsonrecords the pools of both servers for every comparison in the evidence. Comparisons on one server have identical pools; every comparison across two servers had different pools.The evidence README flags each of these where it is reported.
Analysis (5784971)
analyze_all.shanalysesruns_pinned/withpairs_pinned.json(cap 8 labels) into*_pinnedevidence files. It also keeps analysing the unpinnedruns/.compare.pyandcycles.pynow require--runs.runs_pinned/exists, a pair with a missing run fails the script, unlessSTATE_ALLOW_MISSING=1is set.compare.pyalso recordsmissing_pairs.Mixed regimes are refused (0ac8751)
run_matrix.pyrefuses to write into a root that already holds runs of the other pool regime, including linked reference directories.compare.pyrefuses any pair of a pinned and an unpinned run.--allow-mixed-pinsoverrides either refusal, and the output keeps the flag (pinned_a/pinned_bper pair,mixed_pin_pairs).equality_tuned.shpasses--no-pin, so it matches its unpinned reference.