Repository navigation
Expand file tree
/
Copy pathrender_results.py
More file actions
1053 lines (970 loc) · 49 KB
/
Copy pathrender_results.py
File metadata and controls
1053 lines (970 loc) · 49 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
"""Render the README "Results" and "Revision history" sections from data.
Every figure in those sections is computed here, from the published
per-trial CSVs in results/published/, and pasted into the README verbatim.
Nothing is hand-transcribed. This exists because hand-transcription put two
fabricated flip rates into a published table (see the revision history it
renders); `tests/test_readme_matches_data.py` independently recomputes every
README table figure, but generation is the stronger guarantee — a number
that was never typed cannot be mistyped.
Usage:
python3 tools/render_results.py
Prints the markdown block to stdout. Replace everything in README.md
between the BEGIN/END GENERATED markers (markers included) with the
output, then run the test suite.
Statistics, matching the harness's house style (stdlib only):
- Descriptive per-cell statistics and flip rates with 95% Wilson-based
intervals come from the same `flipgate` functions the reports use
(population sd, `flip_rate_ci`).
- Mean comparisons use `flipgate.permutation_test_mean_diff`: a two-sided
seeded permutation test (10,000 shuffles, seed 20260823, add-one
estimate), the harness's authoritative verdict on a delta.
- Spread comparisons use a Levene-style permutation test: each observation
is transformed to its absolute deviation from its own group's mean, and
the same permutation machinery is applied to the transformed values.
Ties at the observed statistic are counted (the permutation function's
`>= observed - 1e-12` rule), which is the conservative choice; an
implementation that drops floating-point ties reports smaller p-values
on the same data (e.g. 0.0028 rather than 0.0043 for the
between-session comparison), so the tie-counting values published here
are the honest ones.
- Heterogeneity across more than two groups uses `omnibus_permutation_p`
below: a one-sided seeded permutation test on a spread-of-per-group-
statistics measure. It is a k-group generalisation of the same idea,
written here rather than in the harness because the harness's public
API is deliberately two-group. It follows the same conventions —
sorted pool (so the p-value does not depend on the order the groups
are supplied in), ties counted, add-one estimate.
"""
from __future__ import annotations
import csv
import datetime
import json
import random
import statistics
import sys
import textwrap
from collections import defaultdict
from pathlib import Path
from typing import Callable, Dict, List, Sequence, Tuple
ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(ROOT))
import flipgate # noqa: E402 (stdlib-only harness; import is side-effect free)
PUBLISHED = ROOT / "results" / "published"
THRESHOLD = 7.0
WIDTH = 74
CellKey = Tuple[str, str, str] # (condition, rubric_key, artifact_key)
# The strictly identical cell measured in every between-session run.
SESSION_CELL: CellKey = ("repeat", "canonical", "ratelimiter")
# Runs containing that cell, listed in no particular order — the rendered
# table sorts them by the data.
SESSION_RUNS = (
"full-002",
"interleaved-001",
"session-01",
"session-02",
"session-03",
)
# The omnibus test uses more shuffles than the harness's pairwise default
# because its p-value is small enough that the resolution matters; the seed
# is the harness's, so every p-value in this README shares one seed.
OMNIBUS_SHUFFLES = 20000
OMNIBUS_SEED = flipgate.PERM_SEED
# Two runs belong to the same "burst" — one contiguous block of wall-clock
# time — if their starts are closer together than this. The value is a
# reporting convention, not a tuned parameter: it separates runs launched
# back-to-back from runs launched in separate sittings, and the actual gaps
# either side of the split are printed so a reader can judge it. The burst
# subset is defined by timing alone, fixed before any statistic on it is
# computed.
BURST_GAP_S = 15 * 60
# Significance level used only to choose between honest phrasings of the
# burst-restricted result. Nothing is suppressed at either branch.
ALPHA = 0.05
def load_cells(run_id: str) -> Dict[CellKey, List[int]]:
cells: Dict[CellKey, List[int]] = defaultdict(list)
path = PUBLISHED / f"{run_id}_trials.csv"
with path.open() as fh:
for row in csv.DictReader(fh):
if str(row.get("parse_ok", "")).lower() not in ("1", "true"):
continue
key = (row["condition"], row["rubric_key"], row["artifact_key"])
cells[key].append(int(row["score"]))
if not cells:
raise SystemExit(f"no parsed trials found in {path}")
return dict(cells)
def levene_style_p(a: List[int], b: List[int]) -> float:
"""Two-sided permutation p-value for a difference in spread.
Brown–Forsythe-flavoured: transform each observation to its absolute
deviation from its own group's mean, then run the harness's seeded
mean-difference permutation test on the transformed values.
"""
ma, mb = statistics.mean(a), statistics.mean(b)
da = [abs(x - ma) for x in a]
db = [abs(x - mb) for x in b]
return flipgate.permutation_test_mean_diff(da, db)
GroupStat = Callable[[Sequence[Sequence[int]]], float]
def spread_of_sds(groups: Sequence[Sequence[int]]) -> float:
"""Population sd of the per-group population sds — how unequal the spreads are."""
return statistics.pstdev([statistics.pstdev(g) for g in groups])
def spread_of_means(groups: Sequence[Sequence[int]]) -> float:
"""Population sd of the per-group means — how unequal the levels are."""
return statistics.pstdev([statistics.mean(g) for g in groups])
def omnibus_permutation_p(
groups: Sequence[Sequence[int]],
statistic: GroupStat,
shuffles: int = OMNIBUS_SHUFFLES,
seed: int = OMNIBUS_SEED,
) -> Tuple[float, float]:
"""(observed, p) for heterogeneity across k groups under label exchange.
The null is that the group labels carry no information: every score
could equally have come from any group. Pool all observations, reshuffle
them into groups of the original sizes, recompute `statistic`, and count
how often the shuffled statistic is at least as large as the observed
one. One-sided by construction — `statistic` measures dispersion among
the per-group values, which the alternative can only inflate.
Conventions match `flipgate.permutation_test_mean_diff`: the pool is
sorted first, so the p-value does not depend on the order the groups
were supplied in; ties at the observed value are counted, which is the
conservative choice; and the add-one estimate (count + 1) /
(shuffles + 1) is used, so the result can never be reported as zero.
"""
if len(groups) < 2 or any(len(g) < 2 for g in groups):
raise ValueError("omnibus test needs at least 2 groups of at least 2")
observed = statistic(groups)
sizes = [len(g) for g in groups]
pool = sorted(s for g in groups for s in g)
rng = random.Random(seed)
count = 0
for _ in range(shuffles):
rng.shuffle(pool)
parts: List[Sequence[int]] = []
start = 0
for size in sizes:
parts.append(pool[start:start + size])
start += size
if statistic(parts) >= observed - 1e-12:
count += 1
return observed, (count + 1) / (shuffles + 1)
def load_meta(run_id: str) -> Dict[str, object]:
return json.loads((PUBLISHED / f"{run_id}_run_metadata.json").read_text())
def parse_utc(stamp: str) -> datetime.datetime:
"""Parse the metadata's `_utc` format, e.g. '2026-08-23 09:50:37Z'."""
return datetime.datetime.strptime(stamp, "%Y-%m-%d %H:%M:%SZ").replace(
tzinfo=datetime.timezone.utc
)
def fmt_duration(seconds: float) -> str:
minutes = seconds / 60.0
if minutes < 10:
return f"{minutes:.1f} minutes"
if minutes < 90:
return f"{minutes:.0f} minutes"
whole = int(round(minutes))
hours, rest = divmod(whole, 60)
unit = "hour" if hours == 1 else "hours"
if rest == 0:
return f"{hours} {unit}"
return f"{hours} {unit} {rest} minutes"
def fmt_p(p: float) -> str:
return f"{p:.4f}" if p < 0.01 else f"{p:.3f}"
def fmt_mean(scores: List[int]) -> str:
return f"{statistics.mean(scores):.2f}"
def fmt_sd(scores: List[int]) -> str:
return f"{statistics.pstdev(scores):.3f}"
def fmt_range(scores: List[int]) -> str:
return f"{min(scores)}–{max(scores)}"
def fmt_flip(scores: List[int]) -> str:
return flipgate._fmt_flip_ci(flipgate.flip_rate_ci(scores, THRESHOLD))
def cell_row(label_cells: List[str], scores: List[int]) -> str:
return "| " + " | ".join(
label_cells
+ [
str(len(scores)),
fmt_mean(scores),
fmt_sd(scores),
fmt_range(scores),
fmt_flip(scores),
]
) + " |"
_WORDS = {
1: "one", 2: "two", 3: "three", 4: "four", 5: "five", 6: "six",
7: "seven", 8: "eight", 9: "nine", 10: "ten", 11: "eleven",
12: "twelve", 13: "thirteen", 14: "fourteen", 15: "fifteen",
16: "sixteen", 17: "seventeen", 18: "eighteen", 19: "nineteen",
20: "twenty",
}
def _join(parts: List[str]) -> str:
if len(parts) == 1:
return parts[0]
return ", ".join(parts[:-1]) + " and " + parts[-1]
def score_words(scores: List[int]) -> str:
"""'five 5s, thirteen 6s and two 7s' — prose, but still data-derived."""
parts = []
for value in sorted(set(scores)):
count = scores.count(value)
plural = "" if count == 1 else "s"
parts.append(f"{_WORDS.get(count, str(count))} {value}{plural}")
return _join(parts)
def main() -> int:
il = load_cells("interleaved-001")
f2 = load_cells("full-002")
f3 = load_cells("full-003")
il_meta = load_meta("interleaved-001")
il_seed = il_meta["plan_shuffle_seed"]
# Every published run, so counts and dates in the prose are data-derived.
published_runs = sorted(
p.name.replace("_run_metadata.json", "")
for p in PUBLISHED.glob("*_run_metadata.json")
)
all_meta = {r: load_meta(r) for r in published_runs}
all_dates = sorted({
parse_utc(str(m["run_started_at_utc"])).date() for m in all_meta.values()
})
run_day = all_dates[0].strftime("%-d %B %Y")
parse_rates = {float(m["parse_rate"]) for m in all_meta.values()}
f3_gap = (
parse_utc(str(all_meta["full-003"]["run_started_at_utc"]))
- parse_utc(str(all_meta["full-002"]["run_started_at_utc"]))
).total_seconds()
# Runs whose only cell is the between-session cell: added for that
# finding and nothing else. Read from the metadata, not from run names.
session_cell_key = "/".join(SESSION_CELL)
single_cell_runs = sorted(
r for r, m in all_meta.items()
if list(dict(m["trials_per_cell"])) == [session_cell_key]
)
# --- interleaved-001 cells -------------------------------------------
il_repeat = il[("repeat", "canonical", "ratelimiter")]
il_conly_base = il[("cosmetic", "correctness_only", "ratelimiter")]
il_para = {
k: il[("paraphrase", k, "ratelimiter")]
for k in ("paraphrase_1", "paraphrase_2")
}
il_cos_canon = [
il[("cosmetic", "canonical", f"ratelimiter_cosmetic_{v}")]
for v in "abc"
]
il_cos_conly = [
il[("cosmetic", "correctness_only", f"ratelimiter_cosmetic_{v}")]
for v in "abc"
]
# --- earlier runs ----------------------------------------------------
f2_repeat = f2[("repeat", "canonical", "ratelimiter")]
f2_para = {
k: f2[("paraphrase", k, "ratelimiter")]
for k in ("paraphrase_1", "paraphrase_2")
}
f2_cos_canon = [
f2[("cosmetic", "canonical", f"ratelimiter_cosmetic_{v}")]
for v in "abc"
]
f3_base = f3[("cosmetic", "correctness_only", "ratelimiter")]
f3_cos = [
f3[("cosmetic", "correctness_only", f"ratelimiter_cosmetic_{v}")]
for v in "abc"
]
# --- statistics ------------------------------------------------------
# 1. The withdrawn headline, retested within one run: same base
# artifact, canonical vs correctness_only rubric.
sd_canon = statistics.pstdev(il_repeat)
sd_conly = statistics.pstdev(il_conly_base)
rubric_sd_ratio = sd_conly / sd_canon
p_rubric_spread = levene_style_p(il_repeat, il_conly_base)
p_rubric_mean = flipgate.permutation_test_mean_diff(il_repeat, il_conly_base)
# 2. Between-session stability: the identical repeat cell in five runs.
sd_f2 = statistics.pstdev(f2_repeat)
sd_il = statistics.pstdev(il_repeat)
p_session_spread = levene_style_p(f2_repeat, il_repeat)
sessions = {r: load_cells(r)[SESSION_CELL] for r in SESSION_RUNS}
sess_meta = {r: load_meta(r) for r in SESSION_RUNS}
sess_start = {
r: parse_utc(str(sess_meta[r]["run_started_at_utc"])) for r in SESSION_RUNS
}
sess_end = {
r: parse_utc(str(sess_meta[r]["run_ended_at_utc"])) for r in SESSION_RUNS
}
# Ordered by spread, least to most: the axis the finding is about.
by_sd = sorted(SESSION_RUNS, key=lambda r: statistics.pstdev(sessions[r]))
by_time = sorted(SESSION_RUNS, key=lambda r: sess_start[r])
by_mean_desc = sorted(
SESSION_RUNS, key=lambda r: statistics.mean(sessions[r]), reverse=True
)
sess_groups = [sessions[r] for r in by_sd]
n_sessions = len(SESSION_RUNS)
sess_n_total = sum(len(g) for g in sess_groups)
sess_sds = [statistics.pstdev(sessions[r]) for r in by_sd]
sess_means = [statistics.mean(sessions[r]) for r in by_sd]
sess_flips = [flipgate.flip_rate(sessions[r], THRESHOLD) for r in by_sd]
sd_ratio_all = max(sess_sds) / min(sess_sds)
mean_span_all = max(sess_means) - min(sess_means)
least_stable, most_stable = by_sd[-1], by_sd[0]
obs_sd_spread, p_omni_sd = omnibus_permutation_p(sess_groups, spread_of_sds)
obs_mean_spread, p_omni_mean = omnibus_permutation_p(
sess_groups, spread_of_means
)
# Timing: the sessions are not uniformly spaced, and the table should
# let a reader see that rather than take it on trust.
window_s = (
max(sess_end.values()) - min(sess_start.values())
).total_seconds()
starts_in_order = [sess_start[r] for r in by_time]
consecutive_gaps = [
(b - a).total_seconds()
for a, b in zip(starts_in_order, starts_in_order[1:])
]
# The burst: the longest run of chronologically adjacent sessions whose
# consecutive starts are closer than BURST_GAP_S. Defined by timing
# alone, before any statistic on the subset is computed, so restricting
# the omnibus to it is not a subset chosen for its answer.
clusters: List[List[str]] = [[by_time[0]]]
for prev, run_id, gap in zip(by_time, by_time[1:], consecutive_gaps):
if gap <= BURST_GAP_S:
clusters[-1].append(run_id)
else:
clusters.append([run_id])
burst = max(clusters, key=len)
burst_s = (
max(sess_end[r] for r in burst) - min(sess_start[r] for r in burst)
).total_seconds()
burst_gaps = [
(sess_start[b] - sess_start[a]).total_seconds()
for a, b in zip(burst, burst[1:])
]
# The burst-restricted omnibus: identical procedure, run on the sessions
# among which elapsed time is not a candidate explanation.
burst_testable = len(burst) >= 3
if burst_testable:
obs_burst, p_burst = omnibus_permutation_p(
[sessions[r] for r in burst], spread_of_sds
)
burst_sds = [statistics.pstdev(sessions[r]) for r in burst]
burst_n_total = sum(len(sessions[r]) for r in burst)
burst_significant = p_burst < ALPHA
else:
burst_significant = False
# Whether the "maybe it is just drift across the window" objection has
# been answered by data. Drives both the framing above and whether the
# spacing stays in the limitations list.
spacing_neutralised = burst_testable and burst_significant
sd_monotonic_in_time = (
by_time == by_sd or by_time == list(reversed(by_sd))
)
# Provenance actually recorded for these runs — asserted, not assumed.
sess_models = {str(sess_meta[r]["resolved_model"]) for r in SESSION_RUNS}
sess_aliases = {str(sess_meta[r]["model_alias"]) for r in SESSION_RUNS}
assert len(sess_models) == 1 and len(sess_aliases) == 1, (
"between-session runs no longer share one model"
)
sess_clis = {
r: sess_meta[r]["claude_cli_version"] for r in SESSION_RUNS
}
cli_known = {v for v in sess_clis.values() if v}
cli_missing = sorted(r for r, v in sess_clis.items() if not v)
if len(cli_known) == 1 and not cli_missing:
cli_note = "same CLI version"
elif len(cli_known) == 1:
cli_note = (
"the same CLI version wherever it was recorded ("
+ _join([f"`{r}`" for r in cli_missing])
+ " predates CLI-version recording)"
)
else:
cli_note = "CLI versions as recorded per run"
monotonic_note = "" if sd_monotonic_in_time else (
": in chronological order the per-session sds run "
+ ", ".join(f"{statistics.pstdev(sessions[r]):.3f}" for r in by_time)
+ ", which is not monotonic"
)
sd_order_is_mean_order = by_sd == by_mean_desc
derived_starts = [
r for r in by_sd if sess_meta[r].get("timestamp_caveat")
]
# 3. Cosmetic condition, interleaved run.
cos_canon_pool = [s for cell in il_cos_canon for s in cell]
cos_conly_pool = [s for cell in il_cos_conly for s in cell]
d_cos_canon = statistics.mean(cos_canon_pool) - statistics.mean(il_repeat)
p_cos_canon = flipgate.permutation_test_mean_diff(cos_canon_pool, il_repeat)
d_cos_conly = statistics.mean(cos_conly_pool) - statistics.mean(il_conly_base)
p_cos_conly = flipgate.permutation_test_mean_diff(cos_conly_pool, il_conly_base)
# 4. Paraphrase condition, interleaved run.
para_pool = [s for cell in il_para.values() for s in cell]
d_para = statistics.mean(para_pool) - statistics.mean(il_repeat)
p_para = flipgate.permutation_test_mean_diff(para_pool, il_repeat)
sd_p1_il = statistics.pstdev(il_para["paraphrase_1"])
sd_p1_f2 = statistics.pstdev(f2_para["paraphrase_1"])
p_p1_spread_f2 = levene_style_p(f2_repeat, f2_para["paraphrase_1"])
# 5. Flip-rate extremes across interleaved cells.
flips = {k: flipgate.flip_rate(v, THRESHOLD) for k, v in il.items()}
min_key = min(flips, key=lambda k: flips[k])
max_key = max(flips, key=lambda k: flips[k])
over_half_all = sorted(
(round(v, 3) for v in flips.values() if v > 0.5), reverse=True
)
over_half = sorted(set(over_half_all), reverse=True)
n_over_half = len(over_half_all)
# 6. Historical numbers for the revision history (recomputed, plus the
# fabricated values quoted as published — those match no data by
# construction, which is the point).
f2_p1_flip = flipgate.flip_rate(f2_para["paraphrase_1"], THRESHOLD)
f2_p2_flip = flipgate.flip_rate(f2_para["paraphrase_2"], THRESHOLD)
f2_cos_pool = [s for cell in f2_cos_canon for s in cell]
p_f2_cos = flipgate.permutation_test_mean_diff(f2_cos_pool, f2_repeat)
f3_cos_pool = [s for cell in f3_cos for s in cell]
p_f3_cos = flipgate.permutation_test_mean_diff(f3_cos_pool, f3_base)
sd_f3_base = statistics.pstdev(f3_base)
# --- render ----------------------------------------------------------
out: List[str] = []
def raw(line: str = "") -> None:
out.append(line)
def para(text: str, indent: str = "", first: str = "") -> None:
out.append(
textwrap.fill(
" ".join(text.split()),
width=WIDTH,
initial_indent=first or indent,
subsequent_indent=indent,
break_long_words=False,
break_on_hyphens=False,
)
)
out.append("")
def item(text: str, marker: str) -> None:
para(text, indent=" " * len(marker), first=marker)
raw("<!-- BEGIN GENERATED RESULTS — do not edit by hand.")
raw(" Regenerate with: python3 tools/render_results.py -->")
raw()
raw("## Results")
raw()
assert parse_rates == {1.0}, "prose below claims a 100% parse rate"
assert len(all_dates) == 1, "prose below claims a single run date"
para(f"""
{_WORDS.get(len(published_runs), str(len(published_runs))).capitalize()}
runs against `claude-sonnet-5` via the Claude Code CLI, all on
{run_day}, all with 100% parse rate, all published in
[`results/published/`](results/published/). The primary one is
`interleaved-001` — 200 trials covering all ten cells (three
conditions, both cosmetic rubrics) in a **single run** with the
trial plan shuffled under a recorded seed ({il_seed}), so that no
cell is confounded with execution order, session, or cache warmth.
Alongside it are two earlier full sweeps, `full-002` and `full-003`
({fmt_duration(f3_gap)} apart), and
{_WORDS.get(len(single_cell_runs), str(len(single_cell_runs)))}
single-cell runs,
{_join([f"`{r}`" for r in single_cell_runs])}, which exist only to measure
between-session variation. `interleaved-001` is the sole basis for
every condition comparison below. The between-session finding uses
the {_WORDS.get(len(SESSION_RUNS), str(len(SESSION_RUNS)))} runs
that contain the strictly identical repeat cell
({_join([f"`{r}`" for r in sorted(SESSION_RUNS)])});
{_join([f"`{r}`" for r in published_runs if r not in SESSION_RUNS])}
appears only in the withdrawn-claim discussion and the revision
history.
""")
para("""
Every number in this section and in the revision history is
computed from the published per-trial CSVs by
[`tools/render_results.py`](tools/render_results.py) and pasted as
a block; `tests/test_readme_matches_data.py` independently
recomputes every table figure from the same files. Nothing here is
hand-transcribed.
""")
raw("### Primary run — interleaved-001, all ten cells in one shuffled run")
raw()
para("Gate for flip rate: score ≥ 7. Twenty trials per cell.")
raw("| condition | rubric | artifact | n | mean | sd | range | flip rate @ ≥7 [95% CI] |")
raw("|---|---|---|---|---|---|---|---|")
order: List[CellKey] = [
("repeat", "canonical", "ratelimiter"),
("paraphrase", "paraphrase_1", "ratelimiter"),
("paraphrase", "paraphrase_2", "ratelimiter"),
("cosmetic", "canonical", "ratelimiter_cosmetic_a"),
("cosmetic", "canonical", "ratelimiter_cosmetic_b"),
("cosmetic", "canonical", "ratelimiter_cosmetic_c"),
("cosmetic", "correctness_only", "ratelimiter"),
("cosmetic", "correctness_only", "ratelimiter_cosmetic_a"),
("cosmetic", "correctness_only", "ratelimiter_cosmetic_b"),
("cosmetic", "correctness_only", "ratelimiter_cosmetic_c"),
]
assert sorted(order) == sorted(il.keys()), "cell list drifted from data"
def art_label(art: str) -> str:
return "base" if art == "ratelimiter" else art.replace(
"ratelimiter_cosmetic_", "variant "
)
for cond, rubric, art in order:
raw(cell_row([cond, rubric, art_label(art)], il[(cond, rubric, art)]))
raw()
if over_half:
def times(count: int) -> str:
if count == 1:
return ""
if count == 2:
return " twice"
return f" {_WORDS.get(count, str(count))} times"
vals = _join(
[f"{v:.3f}{times(over_half_all.count(v))}" for v in over_half]
)
many = _WORDS.get(n_over_half, str(n_over_half)).capitalize()
para(f"""
{many} point estimates in the table ({vals}) sit *above* the
theoretical maximum of 0.5 and above their own interval's upper
bound. That is not a typo: the point estimate is the unbiased
pair statistic p·f / C(n,2), which at small n can exceed 0.5
when the pass/fail split is near even, while the interval
bounds the *population* disagreement probability 2·π·(1−π),
which cannot exceed 0.5. Read such cells as "at or near the
maximum possible disagreement", not as a probability above 50%.
METHODOLOGY §1 explains this finite-n artefact of the
estimator.
""")
raw("### Withdrawn: \"the stricter rubric produced a noisier judge\"")
raw()
para(f"""
The previous revision of this README led with the claim that the
correctness-only rubric made the judge *noisier* than the canonical
rubric on identical input. **That claim did not replicate and is
withdrawn** — the second headline claim this project has had to
withdraw, after the cosmetic-edits claim (see the revision
history). It was based on comparing a cell from one sweep
(`full-002`, sd {sd_f2:.3f}) against a cell from another sweep half
an hour later (`full-003`, sd {sd_f3_base:.3f}). The cross-run
confound was disclosed at the time as a threat; it turned out to be
the entire effect. Within `interleaved-001`, where both rubrics
scored the same base artifact in one shuffled session, the same
comparison gives:
""")
item(f"""
canonical rubric: sd {sd_canon:.3f}; correctness-only rubric: sd
{sd_conly:.3f} — a ratio of {rubric_sd_ratio:.2f}×, Levene-style
permutation p = {fmt_p(p_rubric_spread)}. No detectable spread
difference at all.
""", "- ")
item(f"""
(The *means* differ under the two rubrics — {fmt_mean(il_repeat)}
vs {fmt_mean(il_conly_base)}, permutation p =
{fmt_p(p_rubric_mean)} — a level effect, which was never the
claim.)
""", "- ")
para("""
What actually differed between the two sweeps was not the rubric.
It was the session — which is the surviving finding.
""")
raw("### The primary surviving result: the judge's stability varies between sessions")
raw()
para(f"""
The strictly identical cell — condition `repeat`, canonical rubric,
base artifact, same model alias resolving to the same canonical
model (`{sorted(sess_models)[0]}`) in every run, {cli_note}, same
machine — has now been measured in
{_WORDS.get(n_sessions, str(n_sessions))} separate runs,
{sess_n_total} trials in total, all on {run_day}. Ordered by spread,
least to most:
""")
raw("| run | started (UTC) | n | mean | sd | range | flip rate @ ≥7 [95% CI] |")
raw("|---|---|---|---|---|---|---|")
for run_id in by_sd:
raw(cell_row(
[run_id, sess_start[run_id].strftime("%H:%M")], sessions[run_id]
))
raw()
if derived_starts:
para(f"""
({_join([f"`{r}`" for r in derived_starts])}: start time derived
from per-trial timestamps — rows recorded before v0.2 stored
completion time, not start time. Recorded as `timestamp_caveat`
in that run's `_run_metadata.json`.)
""")
para(f"""
**The central tendency is stable across these sessions; the spread
is not. That contrast is the finding.** The
{_WORDS.get(n_sessions, str(n_sessions))} session means span
{mean_span_all:.2f} of a point ({min(sess_means):.2f} to
{max(sess_means):.2f}). The session sds span a factor of
{sd_ratio_all:.2f}× ({min(sess_sds):.3f} to {max(sess_sds):.3f}):
`{most_stable}` produced {score_words(sessions[most_stable])} — a
near-deterministic judge — while `{least_stable}` produced
{score_words(sessions[least_stable])} on the same unchanged input.
In the unit a gate actually pays in, the estimated probability that
two evaluations of that one artifact disagree at a threshold of 7
ranges from {min(sess_flips):.3f} to {max(sess_flips):.3f} depending
on nothing but which session you measured in.
""")
para(f"""
**The omnibus test, stated so it can be rerun.** Pool all
{sess_n_total} scores from the
{_WORDS.get(n_sessions, str(n_sessions))} sessions. The test
statistic is the spread of the per-session spreads: take each
session's population sd, then the population sd of those
{_WORDS.get(n_sessions, str(n_sessions))} numbers — observed
{obs_sd_spread:.3f}. Under the null that session labels are
exchangeable, sort the pool (so the result does not depend on the
order the sessions are supplied in), reshuffle it into
{_WORDS.get(n_sessions, str(n_sessions))} groups of
{len(sess_groups[0])}, and recompute the statistic
{OMNIBUS_SHUFFLES:,} times under seed {OMNIBUS_SEED}, counting
shuffles whose statistic is at least the observed one (ties counted,
the conservative choice) and reporting the add-one estimate
(count + 1) / (shuffles + 1). It is one-sided by construction: the
statistic measures dispersion among the per-session sds, which only
heterogeneity can inflate. Result: **p = {fmt_p(p_omni_sd)}**. The
identical test applied to the spread of the per-session *means* —
same pool, same shuffle count, same seed, observed statistic
{obs_mean_spread:.3f} — gives p = {fmt_p(p_omni_mean)}. The
dispersion differs between sessions; the location does not. The
implementation is `omnibus_permutation_p` in
[`tools/render_results.py`](tools/render_results.py).
""")
if burst_testable:
burst_words = _WORDS.get(len(burst), str(len(burst)))
spacing_facts = f"""
The {_WORDS.get(n_sessions, str(n_sessions))} sessions are not
uniformly spaced: all of them ran inside a window of
{fmt_duration(window_s)} on a single day, the largest gap
between consecutive sessions is
{fmt_duration(max(consecutive_gaps))}, and
{_join([f"`{r}`" for r in burst])} ran back-to-back —
{_join([fmt_duration(g) for g in burst_gaps])} between
consecutive starts and {fmt_duration(burst_s)} end to end. That
invites an obvious objection: perhaps
what the omnibus test detects is drift across the
{fmt_duration(window_s)}, not variation between runs.
"""
if burst_significant:
para(f"""
**The uneven spacing is not the explanation.** {spacing_facts}
It is answerable, because the burst is a subset chosen by
timing alone and fixed before the statistic was computed.
Restricting the identical procedure to
{_join([f"`{r}`" for r in burst])} — pool their
{burst_n_total} scores, statistic = population sd of the
{burst_words} per-session sds ({_join([f"{v:.3f}" for v in burst_sds])}),
observed {obs_burst:.3f}, {OMNIBUS_SHUFFLES:,} shuffles,
seed {OMNIBUS_SEED} — gives **p = {fmt_p(p_burst)}**. Spread
differs detectably even between runs launched minutes apart,
with no opportunity for drift across hours. What varies is
therefore something that differs from run to run, not
something that accumulates with elapsed time, and the fact
that {burst_words} of the
{_WORDS.get(n_sessions, str(n_sessions))} are close to a
repeated sample of one moment is a strength of the design
rather than a weakness: even a repeated sample of one moment
shows it.
""")
para(f"""
Two things that result does *not* do. It is not independent
evidence: it reuses {burst_n_total} of the {sess_n_total}
scores already used above, so it is the same finding
restricted to the subset where the elapsed-time explanation
is unavailable, not a replication of it. And it still says
nothing about the cause — see the limitations below.
""")
else:
para(f"""
**Can the uneven spacing explain it? Not answered.**
{spacing_facts} The test that would answer it is the
identical procedure restricted to
{_join([f"`{r}`" for r in burst])} — pool their
{burst_n_total} scores, statistic = population sd of the
{burst_words} per-session sds ({_join([f"{v:.3f}" for v in burst_sds])}),
observed {obs_burst:.3f}, {OMNIBUS_SHUFFLES:,} shuffles,
seed {OMNIBUS_SEED} — and it gives p = {fmt_p(p_burst)},
which does not reach the {ALPHA} level. On this data the
elapsed-time explanation therefore cannot be ruled out; the
uneven spacing stays in the limitations below as a live
threat rather than a neutralised one.
""")
para("**Limitations, stated as plainly as the finding.**")
if not spacing_neutralised:
why = (
f"""
the burst-restricted test that would separate the two gives p =
{fmt_p(p_burst)}, short of the {ALPHA} level
"""
if burst_testable else
f"""
there is no subset of {_WORDS.get(3, "three")} or more
near-simultaneous sessions to restrict the test to
"""
)
item(f"""
**The sessions are not uniformly spaced, and that is not yet
ruled out as the explanation.** All
{_WORDS.get(n_sessions, str(n_sessions))} ran inside a window of
{fmt_duration(window_s)} on a single day, and the largest gap
between consecutive sessions is
{fmt_duration(max(consecutive_gaps))}. Because
{" ".join(why.split())}, drift across the window cannot be
separated from between-run variation on this data.
""", "- ")
item("""
**This is not a controlled study of *what* drives the variation.**
Provider load, model serving configuration, cache state and time of
day all vary freely between these runs and are mutually confounded.
The data establish that stability varies; they identify no cause,
and none is claimed.
""", "- ")
burst_sample_note = (
f" The burst-restricted test is smaller still —"
f" {_WORDS.get(len(burst), str(len(burst)))} groups of"
f" {len(sessions[burst[0]])}, {burst_n_total} scores — and rests on"
f" {_WORDS.get(len(burst), str(len(burst)))} of the"
f" {_WORDS.get(n_sessions, str(n_sessions))} sessions."
if burst_testable else ""
)
item(f"""
**{_WORDS.get(n_sessions, str(n_sessions)).capitalize()} sessions on
one day is still a small sample.**{burst_sample_note} One artifact,
one judge model, one provider, one day: nothing here speaks to other
days, other load conditions, or other model builds. "Stability
varies materially between runs" is what the omnibus tests support.
"Judges become unstable over time" is not{monotonic_note}; no trend
over time is tested or claimed.
""", "- ")
if sd_order_is_mean_order:
item("""
**The ordering by sd above happens to also be the ordering by
descending mean.** That is not offered as a relationship between
level and spread — at this many sessions it would not be
evidence of one — and it is partly mechanical: the scores pile
on 6 with the observed ceiling of 7 just above, so extra
dispersion has more room to add low scores than high ones and
drags the mean down with it. No such relationship is claimed.
""", "- ")
item("""
**It remains, unavoidably, a between-run comparison** — the design
this project now bans for condition effects (METHODOLOGY §5). It is
legitimate here only because the quantity under study *is* the
between-run variation of an identical cell: nothing else varies by
construction.
""", "- ")
para("""
The practical consequence: a noise-floor measurement from one
session does not automatically describe the same judge an hour
later. Repeat-condition calibration has a shelf life, and any
comparison whose cells were collected in different sessions inherits
the variation measured above.
""")
raw("### Flip rates, measured within one run (interleaved-001)")
raw()
min_label = f"the {min_key[0]} cell" if min_key[0] == "repeat" else (
f"{min_key[0]} / {min_key[1]} / " + art_label(min_key[2])
)
max_label = f"{max_key[0]} / {max_key[1]} / " + art_label(max_key[2])
para(f"""
At a pass threshold of 7, the estimated probability that two
independent evaluations of the same input disagree about the gate
ranges from {fmt_flip(il[min_key])} on {min_label} up to the
theoretical maximum of 0.5 ({max_label} and the other near-even
cells; point estimates above 0.5 are the finite-n artefact
footnoted under the table — the population disagreement probability
cannot exceed 50%). Because all ten cells ran interleaved in one
session, these rates carry no cross-run confound. A CI gate built
on a single judge call is, at these rates, partly a coin flip —
that conclusion has survived every revision this README has been
through.
""")
raw("### Cosmetic and paraphrase conditions")
raw()
para(f"""
**The cosmetic-edits claim remains withdrawn.** An early draft
claimed cosmetic edits significantly moved scores; the
two-standard-error rule behind it was anti-conservative and the
claim was withdrawn (revision history, entry 2). The interleaved
run does not resurrect it. Under the `correctness_only` rubric —
the design's strongest signal, where the judge has no defence for
scoring behaviourally identical variants differently — the pooled
variants sit {d_cos_conly:+.2f} above the base artifact,
permutation p = {fmt_p(p_cos_conly)}: not distinguishable from
sampling noise. Under the canonical rubric the pooled variants sit
{d_cos_canon:+.2f} above the repeat cell, permutation p =
{fmt_p(p_cos_canon)} (uncorrected for the multiple comparisons this
section makes) — but that rubric scores readability, and identifier
names and comment wording *are* readability, so a difference there
measures sensitivity to readability-relevant surface form: a real
hazard for gates, not proof of instrument error (METHODOLOGY §2).
""")
para(f"""
**Paraphrased rubrics:** pooled mean delta {d_para:+.2f} against
the repeat cell, permutation p = {fmt_p(p_para)} — not
distinguishable from noise. The earlier observation that one
paraphrase showed higher spread than the repeat cell (in full-002:
sd {sd_p1_f2:.3f} vs {sd_f2:.3f}, Levene-style permutation p =
{fmt_p(p_p1_spread_f2)}, uncorrected) did not recur: in the
interleaved run that same paraphrase's sd ({sd_p1_il:.3f}) is
*below* the repeat cell's ({sd_il:.3f}). This is consistent with
the between-session finding — the repeat cell's own spread varied
across sessions ({min(sess_sds):.3f} to {max(sess_sds):.3f}) by more
than any within-run condition effect measured here.
""")
para(f"""
The honest one-line summary: **the strongest replicated finding is
not about rubrics, rewordings, or cosmetic edits at all — it is that
the judge's repeat stability, measured on identical input, varied
materially across {_WORDS.get(n_sessions, str(n_sessions))} sessions
while its average answer did not, and that in no configuration
tested is a single judge call a sound basis for a pass/fail
decision.**
""")
raw("### Scope")
raw()
para(f"""
One artifact, one judge model, one provider, one day. These numbers
describe this configuration and should not be generalised to other
models or rubrics without rerunning. The between-session finding now
rests on {_WORDS.get(n_sessions, str(n_sessions))} measurements of
the identical cell rather than
{_WORDS.get(2, "two")} — enough to establish that session-to-session
stability varies materially and to reject the hypothesis that the
{_WORDS.get(n_sessions, str(n_sessions))} sessions share one spread
(p = {fmt_p(p_omni_sd)}), but not enough to characterise the
distribution of session noise floors: all
{_WORDS.get(n_sessions, str(n_sessions))} fall inside a window of
{fmt_duration(window_s)} on one day, unevenly spaced, with no
session-level factor controlled. The harness exists so that
rerunning is cheap — see [METHODOLOGY.md](METHODOLOGY.md) for how to
attack these results.
""")
raw("## Revision history")
raw()
para("""
This project measures whether an instrument gives the same answer
twice; the record of what its own README has claimed and then had
to retract is part of the measurement, and arguably the most useful
part. In order:
""")
item("""
**Withdrawn (overclaim, METHODOLOGY):** an early draft said
condition C "admits no alternative explanation". False under the
canonical rubric, which scores readability — renames and comment
wording are readability-relevant, so the judge has a defence.
Withdrawn; replaced by the two-rubric design (METHODOLOGY §2).
""", "1. ")
item(f"""
**Withdrawn (first headline claim):** "cosmetic edits
significantly move scores", asserted via a two-standard-error rule.
That rule is anti-conservative on small discrete cells; the
permutation tests that replaced it did not confirm the deltas
(canonical pooled, full-002: p = {fmt_p(p_f2_cos)};
correctness-only pooled, full-003: p = {fmt_p(p_f3_cos)}). The
related overstatement that rubric rewordings "move the
distribution" was withdrawn at the same time.
""", "2. ")
item(f"""
**Corrected (two fabricated numbers):** the published results table
carried flip rates of 0.279 and 0.189 for the paraphrase cells; the
values computed from the data are {f2_p1_flip:.3f} and
{f2_p2_flip:.3f}. 0.279 is not even an achievable value of the
estimator at n = 20 — it corresponds to no possible pass/fail
split. The cause was hand-transcription, so the fix is structural,
not behavioural: `tests/test_readme_matches_data.py` now recomputes
every README table figure from the published CSVs and rejects any
flip rate no integer split could produce, and this entire section
is generated by `tools/render_results.py` rather than typed.
""", "3. ")
item("""
**Corrected (false provenance):** run full-003 was recorded with a
clean git SHA taken from a dirty working tree — naming a commit
that could not have produced the run. The exported metadata now
marks the SHA `-dirty` with an explanatory note, and the harness
records tree dirtiness itself.
""", "4. ")
item(f"""
**Withdrawn (second headline claim):** "the stricter rubric
produced the noisier judge", published from a cross-run comparison
(full-002 vs full-003) with the confound disclosed. The interleaved
run refuted it: within one session the two rubrics' spreads are
indistinguishable (sd {sd_canon:.3f} vs {sd_conly:.3f}, p =
{fmt_p(p_rubric_spread)}), while the identical repeat cell differed
across the sessions (p = {fmt_p(p_session_spread)}). The claim is
withdrawn and replaced by the between-session stability finding
above; between-run comparison is now recorded in METHODOLOGY §5 as
a demonstrated validity threat, and interleaving within a single
shuffled run is the required design for any condition comparison.
""", "5. ")
item(f"""
**Strengthened (between-session finding, {_WORDS.get(2, "two")} →
{_WORDS.get(n_sessions, str(n_sessions))} sessions):** the
between-session result was published from a single pair of runs and
caveated as an existence proof that "cannot characterise how often
that happens or by how much".
{_join([f"`{r}`" for r in single_cell_runs])} —
{_WORDS.get(len(single_cell_runs), str(len(single_cell_runs)))}
further runs of the
strictly identical repeat cell, {len(sess_groups[0])} trials each —
have been added and published, bringing the finding to
{_WORDS.get(n_sessions, str(n_sessions))} sessions and
{sess_n_total} trials. Across them the per-session sd spans
{min(sess_sds):.3f} to {max(sess_sds):.3f} ({sd_ratio_all:.2f}×)
while the means span {mean_span_all:.2f}; the omnibus permutation
test on the spread of the per-session sds gives p =
{fmt_p(p_omni_sd)}, and the same test on the spread of the
per-session means gives p = {fmt_p(p_omni_mean)}. No previously
published statistic was revised: the
{_WORDS.get(2, "two")}-session comparison quoted in entry 5 (p =
{fmt_p(p_session_spread)}) is one of the pairs the omnibus test now
subsumes, and every other figure recomputes unchanged from the same
untouched CSVs. {_WORDS.get(2, "two").capitalize()} descriptions did
change with the new data: the run count in the opening paragraph,
and the `full-002` / `full-003` gap, previously given as "roughly 30
minutes" and now printed as the computed {fmt_duration(f3_gap)}.
What changed most is the caveat: the Scope section's "an existence
proof (n = 2 sessions), not a characterisation" is withdrawn as
superseded — not as wrong, it was accurate for the data it
described — and replaced by the limitations stated with the finding
above. The sessions are unevenly
spaced inside a window of {fmt_duration(window_s)} on one day — an
objection taken up in entry 7 — and the study still does not
identify what drives the variation.
""", "6. ")
if burst_testable:
omni_hits = round(p_omni_sd * (OMNIBUS_SHUFFLES + 1)) - 1
verdict = (