Chucks90 commited on
Commit
ea194bb
·
verified ·
1 Parent(s): d99ea58

rarity-route verified: spanning reproduces 0.46, sits between population & concentration, redundancy RULED OUT (incr rank 0.75m); candidate closed form rejected (over-predicts). Paper #2 §2 = two routes: low-rank existence proof (2a) + measured rarity mechanism (2b)

Browse files
jobs/rarity_route_verify_job.py ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # /// script
2
+ # requires-python = ">=3.10"
3
+ # dependencies = [
4
+ # "torch", "torchvision", "numpy", "pillow", "scikit-learn", "scipy",
5
+ # "huggingface_hub>=0.34", "dinov3 @ git+https://github.com/facebookresearch/dinov3",
6
+ # ]
7
+ # ///
8
+ """Verify the RARITY-ROUTE identity for spanning's lesion retention. HF Job (GPU).
9
+
10
+ Tests whether spanning (farthest-point) selection's lesion retention R_span(rho) is PREDICTED by the
11
+ closed form R_pred(rho) = 1 - F_les( Q_bg(1-rho) ) on OUTLIER ENERGY sigma = residual beyond the
12
+ background subspace -- the rarity route -- and reproduces the medical gap (~0.46 @ rho=0.25). Also
13
+ rules out the REDUNDANCY explanation by measuring the lesion cluster's incremental rank beyond
14
+ background. Masks analysis-only. Emits RARITY_RESULT.
15
+ """
16
+ from __future__ import annotations
17
+ import json, os, sys, time
18
+ from pathlib import Path
19
+ import numpy as np, torch
20
+ from PIL import Image
21
+ from sklearn.neighbors import NearestNeighbors
22
+ from huggingface_hub import hf_hub_download
23
+ sys.path.insert(0,"/mnt/processed/covtoken_code")
24
+ from dinov3.models.vision_transformer import vit_base # noqa: E402
25
+
26
+ BACKBONE_REPO="ricklisz123/MedDINOv3-ViTB-16-CT-3M"; MNT=Path("/mnt")
27
+ RAW_LIDC=MNT/"raw"/"lidc"; MASK_ROOT=MNT/"processed"/"lidc_v2"; OUT=MNT/"processed"/"covtoken"
28
+ N_PATCH,CLS_OFF=196,5; LAYER=int(os.environ.get("LAYER","2"))
29
+ BANK_SLICES=int(os.environ.get("BANK_SLICES","500")); EVAL_SLICES=int(os.environ.get("EVAL_SLICES","800"))
30
+ RHOS=[0.1,0.25,0.5,0.75]; QS=[32,64,128]
31
+ CT_MEAN=np.array([0.485,0.456,0.406],np.float32); CT_STD=np.array([0.229,0.224,0.225],np.float32)
32
+ def log(m): print(f"[rarity] {m}", flush=True)
33
+
34
+
35
+ def load_backbone(device):
36
+ ck=hf_hub_download(BACKBONE_REPO,"model.pth",token=os.environ.get("HF_TOKEN"))
37
+ m=vit_base(drop_path_rate=0.0,layerscale_init=1e-5,n_storage_tokens=4,qkv_bias=False,mask_k_bias=True)
38
+ raw=torch.load(ck,map_location="cpu"); sd=raw.get("teacher",raw)
39
+ sd={(k[9:] if k.startswith("backbone.") else k):v for k,v in sd.items()}
40
+ m.load_state_dict(sd,strict=False); m.eval().to(device)
41
+ for p in m.parameters(): p.requires_grad_(False)
42
+ feats={}
43
+ def h(_m,_i,out):
44
+ while isinstance(out,(list,tuple)): out=out[0]
45
+ feats[0]=out.detach()
46
+ m.blocks[LAYER].register_forward_hook(h); return m,feats
47
+
48
+
49
+ def to_t(p):
50
+ im=Image.open(p).convert("RGB").resize((224,224),Image.BILINEAR)
51
+ return torch.from_numpy(((np.asarray(im,np.float32)/255.0-CT_MEAN)/CT_STD)).permute(2,0,1)
52
+
53
+
54
+ @torch.inference_mode()
55
+ def tok(model,feats,imgs,device):
56
+ model.forward_features(imgs.to(device,torch.float32))
57
+ return feats[0][:,CLS_OFF:CLS_OFF+N_PATCH,:].float().cpu().numpy()
58
+
59
+
60
+ def fps(Z,k,seed_idx):
61
+ n=len(Z); keep=[seed_idx]; d2=((Z-Z[seed_idx])**2).sum(1)
62
+ for _ in range(k-1):
63
+ j=int(np.argmax(d2)); keep.append(j); d2=np.minimum(d2,((Z-Z[j])**2).sum(1)); d2[keep]=-1
64
+ return np.array(keep)
65
+
66
+
67
+ def main():
68
+ t0=time.time(); device=torch.device("cuda" if torch.cuda.is_available() else "cpu")
69
+ model,feats=load_backbone(device); rng=np.random.default_rng(0)
70
+ scan_split=json.load(open(hf_hub_download("Chucks90/eryon-data-pipelines","manifests/lidc/splits_v1.0.0.json",repo_type="dataset",token=os.environ.get("HF_TOKEN"))))["splits"]
71
+ train=[]
72
+ for b in sorted(RAW_LIDC.glob("batch_*")):
73
+ for sd in b.iterdir():
74
+ if sd.is_dir() and scan_split.get(sd.name)=="train": train+=sorted(sd.glob("slice_*.png"))
75
+ train=[train[i] for i in rng.choice(len(train),min(BANK_SLICES,len(train)),replace=False)]
76
+ ev=[]
77
+ for cd in sorted((MASK_ROOT/"test").iterdir()):
78
+ npz=cd/"patch_masks.npz"
79
+ if cd.is_dir() and npz.exists():
80
+ pm=np.load(npz)["patch_masks"]
81
+ for idx in range(len(pm)):
82
+ if pm[idx].sum()>0: ev.append((cd/f"slice_{idx:04d}.png", pm[idx].reshape(-1)))
83
+ ev=[ev[i] for i in rng.choice(len(ev),min(EVAL_SLICES,len(ev)),replace=False)]
84
+ log(f"device={device.type}; bank={len(train)} eval(lesion+)={len(ev)} layer block {LAYER+1}")
85
+
86
+ # background bank: membership kNN + subspace U_B (PCA) for residual outlier energy
87
+ B=[]
88
+ for i in range(0,len(train),48): B.append(tok(model,feats,torch.stack([to_t(p) for p in train[i:i+48]]),device).reshape(-1,768))
89
+ B=np.concatenate(B); muB=B.mean(0,keepdims=True); Bc=B-muB
90
+ knn=NearestNeighbors(n_neighbors=11).fit(B[rng.choice(len(B),min(40000,len(B)),replace=False)])
91
+ _,_,Vt=np.linalg.svd(Bc[rng.choice(len(Bc),min(60000,len(Bc)),replace=False)],full_matrices=False)
92
+ UB={q:Vt[:q] for q in QS}
93
+ # background outlier-energy distribution per q (for quantiles)
94
+ bg_sigma={q: (np.linalg.norm(Bc - (Bc@UB[q].T)@UB[q],axis=1)) for q in QS}
95
+ bg_sigma={q: s[rng.choice(len(s),min(60000,len(s)),replace=False)] for q,s in bg_sigma.items()}
96
+
97
+ R_span={r:[] for r in RHOS}; R_conc={r:[] for r in RHOS}; R_out={q:{r:[] for r in RHOS} for q in QS}
98
+ les_sigma={q:[] for q in QS}; inc_rank=[] # lesion residual energy + incremental rank beyond bg
99
+ for i in range(0,len(ev),48):
100
+ ch=ev[i:i+48]; T=tok(model,feats,torch.stack([to_t(p) for p,_ in ch]),device)
101
+ for b,(_,m) in enumerate(ch):
102
+ Z=T[b]; li=set(np.where(m>0)[0].tolist()); ml=len(li)
103
+ if ml==0: continue
104
+ mem,_=knn.kneighbors(Z); mem=mem[:,1:].mean(1) # membership (concentration score)
105
+ for q in QS:
106
+ Zc=Z-muB; sig=np.linalg.norm(Zc-(Zc@UB[q].T)@UB[q],axis=1) # outlier energy sigma
107
+ les_sigma[q]+=sig[list(li)].tolist()
108
+ for r in RHOS:
109
+ k=max(1,round(r*N_PATCH)); seed=int(np.argmax(mem))
110
+ R_span[r].append(len(li & set(fps(Z,k,seed).tolist()))/ml)
111
+ R_conc[r].append(len(li & set(np.argsort(-mem)[:k].tolist()))/ml)
112
+ for q in QS:
113
+ Zc=Z-muB; sig=np.linalg.norm(Zc-(Zc@UB[q].T)@UB[q],axis=1)
114
+ R_out[q][r].append(len(li & set(np.argsort(-sig)[:k].tolist()))/ml)
115
+ # incremental rank of lesion tokens beyond background top-128 subspace (ruling out redundancy)
116
+ Zc=Z-muB; res=Zc-(Zc@UB[128].T)@UB[128]; resl=res[list(li)]
117
+ if ml>=4:
118
+ s=np.linalg.svd(resl-resl.mean(0,keepdims=True),compute_uv=False)
119
+ p=s/(s.sum()+1e-9); inc_rank.append(float(np.exp(-(p*np.log(p+1e-9)).sum()))/ml)
120
+
121
+ res={"backbone":"MedDINOv3","layer_block":LAYER+1,"rhos":RHOS,"qs":QS,"curves":{}}
122
+ for r in RHOS:
123
+ res["curves"][str(r)]={"R_span":round(float(np.mean(R_span[r])),4),"R_conc":round(float(np.mean(R_conc[r])),4),
124
+ "R_population":r,"R_out_by_q":{str(q):round(float(np.mean(R_out[q][r])),4) for q in QS}}
125
+ # closed-form prediction R_pred(rho)=1-F_les(Q_bg(1-rho))
126
+ pred={}
127
+ for q in QS:
128
+ ls=np.array(les_sigma[q]); pred[str(q)]={}
129
+ for r in RHOS:
130
+ tau=np.quantile(bg_sigma[q],1-r); pred[str(q)][str(r)]=round(float((ls>tau).mean()),4)
131
+ res["R_pred_closedform"]=pred
132
+ res["lesion_incremental_rank_over_m_beyond_bg128"]=round(float(np.mean(inc_rank)),3) if inc_rank else None
133
+ # verdict: does any q's closed form track R_span and reproduce ~0.46@0.25?
134
+ span025=res["curves"]["0.25"]["R_span"]
135
+ errs={q: float(np.mean([abs(pred[str(q)][str(r)]-res["curves"][str(r)]["R_span"]) for r in RHOS])) for q in QS}
136
+ bestq=min(errs,key=errs.get)
137
+ res["verdict"]={
138
+ "R_span_at_0.25":span025,"reproduces_medical_gap":bool(abs(span025-0.46)<0.07),
139
+ "best_q":bestq,"mean_abs_pred_error":round(errs[bestq],4),
140
+ "closedform_predicts_spanning":bool(errs[bestq]<0.06),
141
+ "outlier_credit_C_at_0.25":round((span025-0.25)/0.75,3),
142
+ "redundancy_ruled_out":bool((res["lesion_incremental_rank_over_m_beyond_bg128"] or 0)>0.5),
143
+ "interpretation":("RARITY-ROUTE IDENTITY VERIFIED: closed form 1-F_les(Q_bg(1-rho)) tracks spanning retention; "
144
+ "spanning sits between population rate and concentration; redundancy ruled out (lesion incremental rank high)."
145
+ if errs[bestq]<0.06 else
146
+ "Closed form does NOT cleanly predict spanning; fall back to two-route framing (existence proof + rarity carries data).")}
147
+ res["elapsed_s"]=round(time.time()-t0,1)
148
+ OUT.mkdir(parents=True,exist_ok=True); (OUT/"rarity_route_verify.json").write_text(json.dumps(res,indent=2))
149
+ print("RARITY_RESULT "+json.dumps(res),flush=True)
150
+
151
+
152
+ if __name__=="__main__": main()
paper/paper2_rank_objectives_draft.md CHANGED
@@ -35,7 +35,16 @@ But many high-stakes tasks are the opposite: the signal is *rare and concentrate
35
  nodule, a microcalcification, an anomalous event. We ask whether rank-style objectives, used to
36
  gate token pruning or as SSL regularizers, help or hurt such tasks, and derive when.
37
 
38
- ## 2. The law (closed form, synthetic)
 
 
 
 
 
 
 
 
 
39
 
40
  **Setup.** Background tokens are isotropic; a signal of effective rank r is injected across m
41
  tokens (r=1 fully aligned, r=m fully diverse), each high energy in a lesion/anomaly subspace L. At
@@ -44,13 +53,46 @@ farthest-point / effective-rank maximization in L.
44
 
45
  **Result (Fig. 1).** spanning retention `= min(r,m)/m`; concentration retention `= 1`; **gap
46
  `= (m-r)/m`; crossover `r* = m`.** A spanning objective retains a signal only in proportion to its
47
- rank; it ties concentration only when the signal is fully diverse. (Multi-seed: §5.)
 
48
 
49
  **Alignment surface.** Adding an SNR axis yields `A(r, SNR)`: concentration dominates iff the
50
  signal is concentrated (r<m) AND distinct (high SNR); at low SNR both lose the signal. This
51
  predicts when rank/spanning regularization is safe (high task-rank or low-SNR-anyway) vs harmful
52
  (rare, salient signal).
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  ## 3. The mechanism is SELECTION, not SCALING (a sharpening)
55
 
56
  A natural worry is over-generalization. We separate two things "rank" conflates. As a *selection*
 
35
  nodule, a microcalcification, an anomalous event. We ask whether rank-style objectives, used to
36
  gate token pruning or as SSL regularizers, help or hurt such tasks, and derive when.
37
 
38
+ ## 2. The law: two routes to set-spectrum blindness
39
+
40
+ A set-level rank/coverage objective optimizes the *retained set's* spectrum, which is insensitive to
41
+ a rare critical cluster by **either** of two routes — the cluster is internally **low-rank**, *or* it
42
+ is simply too **few** tokens (rarity) to move set-level coverage. This section gives the closed form
43
+ for the low-rank route as a clean **existence proof**; §4 shows — by direct measurement — that *real
44
+ lesions take the rarity route, not this one*, and §2b states the rarity-route identity that carries
45
+ the data.
46
+
47
+ ### 2a. The low-rank route (closed form, synthetic — existence proof)
48
 
49
  **Setup.** Background tokens are isotropic; a signal of effective rank r is injected across m
50
  tokens (r=1 fully aligned, r=m fully diverse), each high energy in a lesion/anomaly subspace L. At
 
53
 
54
  **Result (Fig. 1).** spanning retention `= min(r,m)/m`; concentration retention `= 1`; **gap
55
  `= (m-r)/m`; crossover `r* = m`.** A spanning objective retains a signal only in proportion to its
56
+ rank; it ties concentration only when the signal is fully diverse. (Multi-seed: §5.) This isolates
57
+ *one* mechanism; it is deliberately not a claim about real lesion geometry (which §4 measures).
58
 
59
  **Alignment surface.** Adding an SNR axis yields `A(r, SNR)`: concentration dominates iff the
60
  signal is concentrated (r<m) AND distinct (high SNR); at low SNR both lose the signal. This
61
  predicts when rank/spanning regularization is safe (high task-rank or low-SNR-anyway) vs harmful
62
  (rare, salient signal).
63
 
64
+ ### 2b. The rarity route (mechanistically verified; the route the real data takes)
65
+
66
+ Real lesions are *diverse* but **rare** (`π=m/n ≪ 1`). At budget fraction `ρ`, a spanning selection
67
+ spends its budget covering the abundant high-dimensional background, so a rare cluster claims only a
68
+ budget-proportional-plus-outlier share. We verify this directly on the real lesion spectrum (LIDC,
69
+ operating layer; `research_v4/rarity_route_verify.json`), measuring the spanning (farthest-point)
70
+ lesion retention `R_span(ρ)` against population (`R_pop=ρ`) and concentration (`R_conc`) references:
71
+
72
+ | ρ | R_pop | **R_span** | R_conc |
73
+ |---|---|---|---|
74
+ | 0.10 | 0.10 | 0.152 | 0.435 |
75
+ | 0.25 | 0.25 | **0.460** | 0.795 |
76
+ | 0.50 | 0.50 | 0.812 | 0.974 |
77
+ | 0.75 | 0.75 | 0.980 | 1.000 |
78
+
79
+ Three facts establish the rarity mechanism. (i) Spanning **reproduces the medical gap**,
80
+ `R_span(0.25)=0.46`. (ii) `R_span` lies strictly **between** the population rate and concentration at
81
+ every budget — a rare cluster gets *partial* outlier credit (`C=(R_span−ρ)/(1−ρ)=0.28` at ρ=0.25),
82
+ not the full retention concentration gives it. (iii) **Redundancy is ruled out**: the lesion
83
+ cluster's incremental effective rank beyond the background subspace is high (0.75·m), so its tokens
84
+ are diverse *even orthogonal to background* — the loss is not within-cluster redundancy but rarity
85
+ (budget spent covering background). This is the technical crux: spanning drops a *diverse* cluster
86
+ because it is *few*, not because it is redundant.
87
+
88
+ We do **not** claim a closed form here. The natural per-token candidate `R_span(ρ)=1−F_les(Q_bg(1−ρ))`
89
+ on outlier energy *over-predicts* at every budget (mean error 0.15), because a per-token score keeps
90
+ all high-energy lesion tokens (concentration-like) whereas spanning spreads budget; the outlier
91
+ credit is also non-constant in `ρ`. An exact rarity-route identity is a budget-allocation/covering
92
+ (DPP-like) object we leave open. The law therefore stands as: a verified **existence proof** for the
93
+ low-rank route (§2a) plus the **measured, redundancy-excluded rarity mechanism** (§2b) that carries
94
+ the real data — the closed form describes a parallel route, and we say so.
95
+
96
  ## 3. The mechanism is SELECTION, not SCALING (a sharpening)
97
 
98
  A natural worry is over-generalization. We separate two things "rank" conflates. As a *selection*
research_v4/rarity_route_derivation.md ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # The rarity-route identity (candidate — VERIFICATION OUTCOME below)
2
+
3
+ > **OUTCOME (verified `rarity_route_verify.json`):** the rarity *mechanism* is confirmed — spanning
4
+ > reproduces the medical gap (R_span(0.25)=0.46), sits between population rate and concentration
5
+ > (outlier credit C=0.28), and **redundancy is ruled out** (lesion incremental rank/m beyond
6
+ > background = 0.75). BUT the candidate **closed form below over-predicts** (mean error 0.15): a
7
+ > per-token σ top-k is concentration-like and keeps all high-energy lesion tokens, while spanning
8
+ > spreads budget. So the closed form is **rejected**; the law ships as existence proof (§2a) + the
9
+ > measured, redundancy-excluded rarity mechanism (§2b). An exact spanning identity (DPP/covering) is
10
+ > left open.
11
+
12
+
13
+ ## Two routes to set-spectrum blindness
14
+ A set-level rank/coverage objective `C(S)=effrank(P_L Z_S)` optimizes the *retained set's* spectrum,
15
+ which is insensitive to a rare critical cluster by **either** of two routes:
16
+
17
+ - **Low-rank route (synthetic, paper-2 §2).** The cluster is internally low-rank (effective rank
18
+ `r < m`). Closed form: spanning retention `min(r,m)/m`, gap `(m−r)/m`, crossover `r*=m`. This is an
19
+ **existence proof**; it is *not* the route real lesions take (measured lesion rank 339 > background 307).
20
+ - **Rarity route (real data).** The cluster is internally *diverse* but **rare** (`π=m/n ≪ 1`). The
21
+ budget `k=ρn` is spread over the abundant high-dimensional background; the cluster claims only a
22
+ budget-proportional-plus-outlier share.
23
+
24
+ ## Candidate identity (rarity route)
25
+ Order tokens by spanning-relevant **outlier energy** `σ_i = ‖(I−U_B U_Bᵀ)(z_i−μ_B)‖` (residual beyond
26
+ the background subspace `U_B`). A spanning selection retains the top-`k` by `σ`. With `π→0` (rarity),
27
+ the top-`ρ` threshold is set by the **background** quantile, so the lesion retention is
28
+
29
+ **R_span(ρ) ≈ 1 − F_les( Q_bg(1−ρ) )**,
30
+
31
+ where `F_les` is the CDF of lesion outlier energy and `Q_bg(1−ρ)` the `(1−ρ)`-quantile of background
32
+ outlier energy. Limits, matching the "between population rate and full retention" intuition:
33
+ - lesion σ ≫ background σ (strong outlier credit) ⇒ `R_span → 1`;
34
+ - lesion σ ≈ background σ (no credit) ⇒ `R_span → ρ` (population rate);
35
+ - in between, `R_span ∈ (ρ, 1)`, position set by the outlier-energy shift. Outlier credit
36
+ `C = (R_span−ρ)/(1−ρ)`.
37
+
38
+ This **predicts the medical gap** (target: `R_span(0.25) ≈ 0.46`, i.e. `C ≈ 0.28`) from a *measured*
39
+ energy distribution, rather than from a parallel low-rank law.
40
+
41
+ ## Redundancy must be ruled out (the technical check)
42
+ The competing explanation for `R_span(0.25)=0.46` is within-cluster **redundancy** (FPS covers a tight
43
+ blob with few points). This is **already refuted by the spectrum**: lesion tokens are *more* spread
44
+ than background (top-10 SV fraction 0.176 < 0.203; RankMe 339 > 307), so they are not mutually
45
+ redundant. The verification job confirms it by also measuring the lesion cluster's *incremental* rank
46
+ beyond the background subspace — if that is large, redundancy cannot be the cap, and rarity (budget
47
+ spent on background) is the operative mechanism.
48
+
49
+ ## Verification plan
50
+ Measure, at the operating layer (LIDC, masks analysis-only), across budgets ρ∈{0.1,0.25,0.5,0.75}:
51
+ 1. **R_span(ρ)** — actual farthest-point/spanning lesion retention (ground truth; must reproduce 0.46@0.25).
52
+ 2. **R_pred(ρ)** — the closed-form `1 − F_les(Q_bg(1−ρ))` (sweep `U_B` dim `q`).
53
+ 3. **R_conc(ρ)**, **R_pop(ρ)=ρ** — concentration upper / population lower references.
54
+ 4. lesion **incremental rank beyond background** — to rule out redundancy.
55
+ PASS (strong option): `R_pred ≈ R_span` across ρ and reproduces 0.46 ⇒ paper-2 states a derived,
56
+ verified rarity-route identity. ELSE: fall back to the two-route framing (minimum), existence-proof
57
+ only, rarity carrying the data.
research_v4/rarity_route_verify.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "study": "Rarity-route verification — does the closed form predict spanning's lesion retention, and is redundancy ruled out?",
3
+ "backbone": "MedDINOv3", "layer_block": 3, "dataset": "LIDC", "n_eval_lesion_pos": 800,
4
+ "curves_by_rho": {
5
+ "0.10": {"R_population": 0.10, "R_span": 0.152, "R_concentration": 0.435},
6
+ "0.25": {"R_population": 0.25, "R_span": 0.460, "R_concentration": 0.795},
7
+ "0.50": {"R_population": 0.50, "R_span": 0.812, "R_concentration": 0.974},
8
+ "0.75": {"R_population": 0.75, "R_span": 0.980, "R_concentration": 1.000}
9
+ },
10
+ "closed_form_candidate": "R_span(rho) = 1 - F_les(Q_bg(1-rho)) on outlier energy sigma (residual beyond background)",
11
+ "closed_form_pred_best_q32": {"0.10": 0.374, "0.25": 0.692, "0.50": 0.946, "0.75": 0.999},
12
+ "verdict": {
13
+ "reproduces_medical_gap": true, "R_span_at_0.25": 0.460,
14
+ "outlier_credit_C_at_0.25": 0.28,
15
+ "interpolates_between_population_and_concentration": true,
16
+ "redundancy_ruled_out": true, "lesion_incremental_rank_over_m_beyond_bg": 0.754,
17
+ "closed_form_predicts_spanning": false, "mean_abs_pred_error": 0.152,
18
+ "why_closed_form_fails": "A per-token outlier-energy top-k keeps ALL high-energy lesion tokens (concentration-like) and so OVER-predicts FPS retention at every budget (+0.13 to +0.23). Spanning spreads budget across the background; its rare-cluster retention is not a per-token score threshold, so no per-token sigma reproduces the curve. The outlier credit C is also not constant (0.06, 0.28, 0.62, 0.92 across rho) -- ruling out R_span=rho+C(1-rho) too."
19
+ },
20
+ "outcome": {
21
+ "decision": "MINIMUM-PLUS: two-route framing kept; rarity route backed by VERIFIED facts, not a derived identity.",
22
+ "verified_facts": [
23
+ "Spanning reproduces the medical gap R_span(0.25)=0.460.",
24
+ "R_span lies strictly between population rate (rho) and concentration at every budget (outlier credit, growing with rho).",
25
+ "Redundancy is ruled out: lesion cluster incremental rank/m beyond the background subspace is 0.754 (high) -- the cluster is diverse even orthogonal to background, so the gap is RARITY (budget spent covering background), not within-cluster redundancy."
26
+ ],
27
+ "left_open": "An exact closed form for spanning's rare-cluster retention. The natural per-token sigma-quantile candidate over-predicts; the correct object is a budget-allocation/covering (DPP-like) derivation, deferred. The synthetic low-rank law (2a) remains the existence proof; the rarity route is mechanistically verified but not yet reduced to a clean identity."
28
+ },
29
+ "human_signoff": null
30
+ }