Repository navigation
State safety: cache-level checks (tap v4): kernels, KV repoint, radix prefill path - #118
Conversation
The tap v4 run hashes the caches each forward reads. With it: - Plain vs MTP steps 3, 40 prompts: every entering cache is identical up to the first differing module output, layer 0's GDN recurrence at the first verify. So the decode and verify recurrent kernels differ from identical inputs and state. - Both history pairs: K and V of all attention layers differ at the shared prefix positions 3+ from decode step 2, and are identical at step 1. This confirms the req_to_token repoint at KV level. - Radix on vs off: the 6 prompts longer than one 64-token GDN chunk differ in the prefill from prompt position 1. The 34 shorter ones are identical. - humaneval-0044 same-server repeats: the GDN prefill differs depending on what the radix tree holds, a second history mechanism; flushed repeats are identical. mechanism.py no longer compares caches at a prefill with no cached prefix, whose stale GDN slot the kernel does not read. compare_repeats writes a path relative to the data root. pools.py covers the new summaries. run_tap_v4.sh records the run's commands.
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2be8dd58b4
ℹ️ 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".
| rm -rf "$T"/v4_* | ||
|
|
||
| echo "v4 smoke $(date +%T)" | ||
| python tap_runs.py --config plain --concurrency 1 --tap-ids "$T/ids_smoke.txt" \ |
There was a problem hiding this comment.
Create the v4 input manifests before reading them
When this script is invoked as documented on a fresh data tree, tap_runs.py immediately reads $T/ids_smoke.txt, but neither this script nor any tracked generator creates that file; the later ids_v4.txt, limits_c1.json, and ids_h44.txt inputs are likewise absent from the repository and undocumented. The run therefore stops with FileNotFoundError before collecting any sessions, so these manifests need to be generated by the script or checked in at a stable path.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in cb8b9df. The prompt lists and per-prompt token limits that run_tap_v4.sh reads (ids_smoke.txt, ids_v4.txt, limits_c1.json, ids_h44.txt) are now committed in experiments/state_safety/tap_v4_inputs/, and the script reads them from there. The four files have the same content as the ones the run used; limits_c1.json only gained a final newline from the end-of-file hook. The history-pair ID files are still generated by the script.
|
Verdict: REQUEST CHANGES Review on the exact head 2be8dd5 ("Add the cache-level checks from the tap v4 run"). Verified
Blocking
Suggestion (non-blocking). The radix paragraph's "From reading the code ... |
… commit tap inputs Reviewer on #118: 1. The cache hashes are taken in state_tap.begin, before the forward's deferred mamba clear zeroes a fresh slot. So a fresh prefill's hash shows leftover state, while the forward reads zeros: the SSM chunk prefill reads the cleared slot, and the conv reads no initial state. The code comment and README now say so, with the run's evidence: 38 such cases, all at fresh prefills in GDN state only, 31 radix pairs identical throughout, 7 identical at the first position. 2. mechanism.py records first_logprob_difference per case. The radix file now shows output index 0 for the 6 long prompts and no difference for the 34 short ones. 3. Codex P2 r4155748473: run_tap_v4.sh's prompt lists and token limits are committed in tap_v4_inputs/ and read from there.
|
@codex review |
|
Verdict: APPROVE (provisional: Codex's review of cb8b9df was still running when I posted this. I will re-check its threads on this head before merge.) Re-review on the exact head cb8b9df ("Correct the fresh-prefill rule's wording; record logprob differences; commit tap inputs").
Blocking: none. Suggestions: none. |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. 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 (confirmed on cb8b9df) Codex finished its review of cb8b9df at 13:27:29 with "Didn't find any major issues". |
Appendix D: cache-level checks of the stock divergences (tap v4, #118)
Cache-level results from the tap v4 run. The tap hashes the KV (per cached position and attention layer) and the GDN conv and SSM state that each tapped forward reads. Every run here is plain decoding or MTP steps 3, at batch 1, with the unpinned flags of the first matrix. The tap engine patch is
engine/sglang/patches/state/0001-state-tap.patch.Results
cachecheck_v4_plain_c1_vs_mtp_s3_c1.json): resolves the pending cache check for the plain-vs-MTP mechanism.history_v4_*.json): each prompt served alone, and right after its predecessor, on fresh servers. This confirms thereq_to_tokenrepoint at KV level for both pairs.mt_bench-0056aftermt_bench-0054, andhumaneval-0008afterhumaneval-0000, the first differing module output is layer 3's attention at output index 2.cachecheck_v4_plain_c1_radix_vs_noradix.json):humaneval-0044same-server repeats (repeats_v4_h44_*.json): this is a second history mechanism, separate from the repoint.Code
mechanism.pyno longer compares caches at a prefill with no cached prefix. Its GDN slot can hold an earlier request's state, which the kernel ignores (has_initial_stateis false). Before this change, that stale state showed up as spurious "cache" origins. There is a unit test for this.compare_repeatswrites a run path relative to the data root.pools.pyalso coverscachecheck_*andhistory_v4_*.run_tap_v4.shrecords the run's commands. The run itself used a scratch copy that named its outputsmechanism_v4_*. The committed summaries were regenerated from the tap data with thismechanism.py.cachecheck_v4_*rather thanmechanism_*, so the paper's first-difference figure input doesn't change.Checks