File size: 8,201 Bytes
87cc7f2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | import json,csv
from pathlib import Path
r=[json.loads(x) for x in Path('results/pilot_001/records.jsonl').read_text(encoding='utf8').splitlines()]; a=json.loads(Path('results/pilot_001/analysis.json').read_text()); cfg=json.loads(Path('results/pilot_001/metadata.json').read_text())['config']; conds=cfg['conditions']; by={(x['source_row'],x['condition']):x for x in r}; rows=sorted({x['source_row'] for x in r}); assert len(r)==120 and len(rows)==20 and len(by)==120
with open('results/pilot_001/paired_outcomes.csv','w',newline='',encoding='utf8') as f:
w=csv.writer(f);w.writerow(['source_row']+conds)
for row in rows:w.writerow([row]+[by[(row,c)]['score']['status'] for c in conds])
matching=sum(by[(row,'edited')]['generated_ids']==by[(row,'emulation')]['generated_ids'] for row in rows);assert matching==20
corrected=[{'source_row':x['source_row'],'condition':x['condition'],'recorded_eos':x['eos'],'corrected_eos':bool(x['generated_ids'] and x['generated_ids'][-1] in [248044,248046])} for x in r if x['eos']!=bool(x['generated_ids'] and x['generated_ids'][-1] in [248044,248046])];Path('results/pilot_001/eos_corrections.json').write_text(json.dumps(corrected,indent=2))
lines=[]
for c in conds:
x=a['conditions'][c];w=x['accuracy_wilson_95'];t=x['tokens'];lines.append(f"| {c} | {x['correct']}/20 | {x['unparsed_or_abstained']}/20 | {x['truncation_count']}/20 | {x['loop_count']}/20 | {t['min']}/{t['median']:.0f}/{t['max']} | {100*w[0]:.1f}–{100*w[1]:.1f}% |")
body='''# Experiment 001: bounded 20-question pilot
## Status and main result
**PASSED:** all 120 paired generations finished without recorded generation errors, and each was committed to the existing Modal volume. All six conditions have 20 distinct rows. **FAILED as a discriminating behavioral test:** 119/120 runs hit the 256-token cap; 119 answers were unparsed or abstained, leaving only one verified answer. There is no defensible conclusion about underlying math accuracy or whether the edited model beats constant steering. This outcome is a limitation of this short, greedy protocol, not a faithful replication of the published 32,768-token sampling protocol.
The edited checkpoint and reconstruction hook generated identical token IDs on all 20 questions. This is strong verification for these deterministic generations and the A10 runtime, not proof of equivalence for every hardware/software configuration. No behavioral advantage for either constant or random steering can be resolved here. The thinking-disabled baseline produced one verified correct response; all other 119 answers are unresolved, not proven incorrect.
| Condition | Verified correct | Unparsed / abstained | Token/time cap | Repetition flag | Tokens min/median/max | 95% Wilson interval for verified-answer rate |
|---|---:|---:|---:|---:|---:|---:|
'''+ '\n'.join(lines)+'''
The table's Wilson intervals are for the **rate of verified correct final answers under this protocol**, treating missing final answers as non-credit. They are not intervals for latent mathematical accuracy. The repetition flag merely means a contiguous four-token sequence appeared four or more times in a response of at least 32 tokens; normal mathematical or formatting repetition can trigger it. It is not a validated detector of pathological loops. One of the flagged responses was the only correct final answer. All but one output had exactly 256 tokens; the remaining response had 170.
## Paired comparison and uncertainty
For verified-answer rate, edited minus thinking-disabled was -5 percentage points: one no-thinking-only verified answer and no edited-only verified answers. A 10,000-resample paired percentile bootstrap gives [-15, 0] percentage points, using the predeclared non-credit convention for unparsed responses. Edited minus each other condition was 0 with bootstrap [0, 0] because **neither condition had any verified answers**. Those degenerate intervals do not establish equivalence and say nothing about correctness of missing answers. Comparisons are exploratory, based on 20 selected items and one greedy seed; multiple comparisons were not adjusted. Every per-question outcome is saved in `results/pilot_001/paired_outcomes.csv`, and full paired values and intervals are in `results/pilot_001/analysis.json`.
## Methods and controls
The 20 source rows were frozen from the pinned HuggingFaceH4/MATH-500 test dataset; they were not used for our calibration, but were part of the published benchmark and may occur in model training. Six conditions: base thinking, base thinking disabled, edited, reconstruction emulation, constant steering along the leading edit direction, and a seeded random-direction control. Prompts, model precision, greedy decoding, seed and 256-token / 45-second caps were matched; thinking-disabled necessarily changes its chat template. No sampling/repetition-control or independently estimated loop direction was evaluated in this pilot. The constant and random vectors have identical fixed magnitudes per layer, calibrated from the RMS of the published weight edit's activation-dependent effect on four separate synthetic prompt activations. This is prompt-token calibration, and held-out generation-time intervention norms were not measured; it does not prove equal intervention energy on every evaluation trajectory. Signs and random vectors were saved before evaluation.
The scorer uses Math-Verify 0.9.0 with a timeout and conservative extraction, preserving correct/incorrect/unparsed/abstained distinctions. Scores and raw outputs are in `results/pilot_001/records.jsonl`; `results/pilot_001/calibration.json` and `metadata.json` record coefficients and settings. The held-out prompts and hashes are in `experiments/`. Loop flags are simple heuristic diagnostics, not claims of actual loops. Math-Verify was tested on known numeric examples, but unresolved symbolic cases require review.
## Implementation correction
The stored `eos` field compared against the tokenizer's EOS ID (248046), while the model also stops on ID 248044. The single 170-token answer ended in 248044; its originally recorded EOS flag is therefore wrong. `results/pilot_001/eos_corrections.json` records the correction, and the controller has been fixed for future runs. The raw journal was preserved. The corrected EOS count is one; the cap count of 119 and the scores are unchanged. The corrected code has not been used to rerun the pilot.
## Compute and costs
The model ran on NVIDIA A10 BF16, PyTorch 2.8.0+cu128, Transformers 5.20.2. The pilot generated 30,634 tokens and recorded 917.27 seconds of per-generation elapsed time; this excludes model loading, calibration, commits, startup and idle time. At the reported $1.10/GPU-hour, the generation elapsed alone corresponds to approximately $0.280 GPU charge before any free credits; it is a lower-bound time-based estimate, not a measured total invoice. The workspace billing snapshot increased from $0.02386665 to $0.59387301 month-to-date metered, a difference of approximately $0.57 inclusive of this pilot's two smoke tests, CPU, memory, GPU and any other concurrent workspace usage. Billed total was $0 after credits at the last snapshot; billing may lag. No active Modal containers remained after completion. No Nebius or Meta inference was used.
## Most useful next step
Pre-register a separate longer-cap experiment with fresh held-out problems and multiple seeds, comparing base thinking, base no-thinking, published edit, and reconstruction under matched sampling. Include model-card sampling/presence-penalty settings as a separate decoding control, and capture trajectory-level intervention norms and termination behavior. Explicitly treat the larger cap and sampling as a new exploratory protocol motivated by the observed truncation; do not tune steering on these evaluation answers. This may reveal whether the edit's gain persists once the baseline has a realistic chance to finish, but the current pilot cannot answer that causal question.
'''
Path('reports/09_pilot_results.md').write_text(body,encoding='utf8');print('report saved, corrected EOS',corrected,'matched generation',matching)
|