The first battery is complete. The JSON shows all the embedding sizes that exist within the CV band.
Parse the sweep.json and find your model attention bands related
to your embedding spaces. This can be used as a differentiation utility to determine how much downstream task is required to compensate for the embedding,
how much should be reduced, how many layers your embeddings can propagate to, and the effective geometric range of those in conjunction.
What This Measures
The Cayley-Menger determinant computes the squared volume of a 4-simplex (pentachoron) formed by 5 randomly sampled embedding vectors. The coefficient of variation (CV) of these volumes across many random samples reveals the geometric operating regime of the embedding space.
CV < 0.13: Degenerate — all simplices look identical, the measurement is blind
The band exists as a function of embedding dimension only. Vocabulary size is irrelevant. Training signal does not move CV — it is a property of the ambient dimensionality.
Key Findings
Dimension
Avg CV
Band Status
D=8
0.605
Above band — volatile
D=16
0.383
Above band — entering
D=24
0.304
Phase boundary — binding constant 0.29154
D=32
0.257
Center of band
D=40
0.229
Center of band
D=48
0.207
Center of band
D=56
0.192
In band
D=64
0.180
In band
D=72
0.168
In band
D=80
0.159
In band
D=88
0.152
In band
D=96
0.144
In band
D=104
0.139
In band
D=112
0.134
In band
D=120
0.129
Below band — exiting
D=128
0.125
Below band
D=256
0.088
Degenerate
D=512
0.063
Degenerate
D=768
0.051
Degenerate
The standard MHA convention of 64 dims per head sits inside the band. This may be a direct causal relationship — the matmul scaling principle in attention operates at the dimensionality where simplex geometry remains discriminative.
Sweep Data
json
1{2"sweep":{"step":8,"low":8,"high":2048},3"band":{"lo":0.13,"hi":0.30},4"band_results":[... 3014 entries sorted by CV ...],5"all_results":[... 65536 entries ...]6}
Each entry: {"V": vocab_size, "D": dim, "CV": value, "in_band": bool}
Download and Nearest Dimensional Lookup
python
1import json
2import urllib.request
34URL ="https://huggingface.co/AbstractPhil/geolip-deep-embedding-analysis/resolve/main/cv_sweep.json"56defload_sweep(path=None):7"""Load sweep from local path or download from HF."""8if path:9withopen(path)as f:10return json.load(f)11with urllib.request.urlopen(URL)as r:12return json.loads(r.read().decode())1314defnearest_band_dim(target_dim, sweep=None):15"""Find the nearest band-valid dimension to your model's embedding dim.
1617 Returns the closest D where CV is in band, plus the expected CV range.
18 Use this to determine compartment size for patchwork decomposition.
1920 Example: Your model uses D=768. This tells you to decompose into
21 compartments of D=32 (24 compartments) or D=64 (12 compartments).
22 """23if sweep isNone:24 sweep = load_sweep()2526# Build D -> CV stats from band_results27 by_dim ={}28for r in sweep["band_results"]:29 d = r["D"]30if d notin by_dim:31 by_dim[d]=[]32 by_dim[d].append(r["CV"])3334 band_dims =sorted(by_dim.keys())35ifnot band_dims:36returnNone3738# Find nearest39 nearest =min(band_dims, key=lambda d:abs(d - target_dim))4041# Also find best decompositions of target_dim42 decompositions =[]43for d in band_dims:44if target_dim % d ==0:45 n_compartments = target_dim // d
46 cvs = by_dim[d]47 decompositions.append({48"compartment_dim": d,49"n_compartments": n_compartments,50"cv_min":round(min(cvs),4),51"cv_max":round(max(cvs),4),52"cv_avg":round(sum(cvs)/len(cvs),4),53})5455 cvs = by_dim[nearest]56return{57"target_dim": target_dim,58"nearest_band_dim": nearest,59"cv_range":[round(min(cvs),4),round(max(cvs),4)],60"cv_avg":round(sum(cvs)/len(cvs),4),61"valid_decompositions":sorted(decompositions, key=lambda x: x["compartment_dim"]),62}636465# ── Usage ──6667if __name__ =="__main__":68for model_dim in[768,1024,512,384,256,128]:69 result = nearest_band_dim(model_dim)70print(f"\n{'='*50}")71print(f"Model dim: {model_dim}")72print(f"Nearest band dim: D={result['nearest_band_dim']} CV={result['cv_avg']:.4f}")73if result["valid_decompositions"]:74print(f"Valid decompositions:")75for dec in result["valid_decompositions"]:76print(f" {dec['n_compartments']:3d} × D={dec['compartment_dim']:3d} "77f"CV={dec['cv_avg']:.4f} [{dec['cv_min']:.4f}-{dec['cv_max']:.4f}]")78else:79print(f" No exact decompositions — consider padding or truncating")
Parse and Filter
python
1import json
23withopen("cv_sweep.json")as f:4 data = json.load(f)56# Filter for any CV range — example: binding constant region7lo, hi =0.290,0.2928hits =[e for e in data["band_results"]if lo <= e["CV"]<= hi]9hits.sort(key=lambda x: x["CV"])1011print(f"CV in [{lo}, {hi}]: {len(hits)} entries")12for h in hits:13print(f" V={h['V']:6d} D={h['D']:4d} CV={h['CV']:.4f}")1415# Group by D16dims ={}17for h in hits:18 dims.setdefault(h["D"],[]).append(h)19for d insorted(dims):20 entries = dims[d]21print(f" D={d:3d}: {len(entries)} entries "22f"CV={min(e['CV']for e in entries):.4f}-{max(e['CV']for e in entries):.4f}")
Rescale and Sort
python
1defrescale_sort(sweep=None, group_by="dim"):2"""Sort and group sweep results for analysis.
34 group_by: 'dim' groups by embedding dimension (recommended)
5 'cv' groups into cv quartiles within band
6 'ratio' groups by V/D ratio
7 """8if sweep isNone:9 sweep = load_sweep()1011 band_lo = sweep["band"]["lo"]12 band_hi = sweep["band"]["hi"]13 results =[r for r in sweep["all_results"]if r["CV"]isnotNone]1415if group_by =="dim":16# Group by D, show band status and CV statistics17 by_dim ={}18for r in results:19 d = r["D"]20if d notin by_dim:21 by_dim[d]={"in_band":[],"below":[],"above":[]}22if r["CV"]> band_hi:23 by_dim[d]["above"].append(r["CV"])24elif r["CV"]< band_lo:25 by_dim[d]["below"].append(r["CV"])26else:27 by_dim[d]["in_band"].append(r["CV"])2829 table =[]30for d insorted(by_dim.keys()):31 g = by_dim[d]32 all_cvs = g["in_band"]+ g["below"]+ g["above"]33 avg =sum(all_cvs)/len(all_cvs)34 table.append({35"D": d,36"avg_cv":round(avg,4),37"in_band_pct":round(100*len(g["in_band"])/len(all_cvs),1),38"n_total":len(all_cvs),39"n_in_band":len(g["in_band"]),40"status":"IN_BAND"if band_lo < avg < band_hi else41"ABOVE"if avg >= band_hi else"BELOW",42})43return table
4445elif group_by =="cv":46# Quartile analysis within band47 band =[r for r in results if band_lo < r["CV"]< band_hi]48ifnot band:49return[]50 band.sort(key=lambda r: r["CV"])51 n =len(band)52return{53"total_in_band": n,54"q1_low":[r for r in band[:n//4]],55"q2_mid_low":[r for r in band[n//4:n//2]],56"q3_mid_high":[r for r in band[n//2:3*n//4]],57"q4_high":[r for r in band[3*n//4:]],58"q1_cv_range":[round(band[0]["CV"],4),round(band[n//4-1]["CV"],4)],59"q2_cv_range":[round(band[n//4]["CV"],4),round(band[n//2-1]["CV"],4)],60"q3_cv_range":[round(band[n//2]["CV"],4),round(band[3*n//4-1]["CV"],4)],61"q4_cv_range":[round(band[3*n//4]["CV"],4),round(band[-1]["CV"],4)],62}6364elif group_by =="ratio":65# Group by V/D ratio — demonstrates V irrelevance66 band =[r for r in results if band_lo < r["CV"]< band_hi]67 by_ratio ={}68for r in band:69 ratio =round(r["V"]/ r["D"],1)70if ratio notin by_ratio:71 by_ratio[ratio]=[]72 by_ratio[ratio].append(r)73return{k:{"count":len(v),"dims":sorted(set(r["D"]for r in v))}74for k, v insorted(by_ratio.items())}757677# ── Usage ──7879if __name__ =="__main__":80 table = rescale_sort(group_by="dim")81print(f"{'D':>5}{'Avg CV':>8}{'Band%':>6}{'Status'}")82print("-"*40)83for row in table:84if row["D"]<=256:85print(f"{row['D']:5d}{row['avg_cv']:8.4f}{row['in_band_pct']:5.1f}% {row['status']}")
The Binding Constant is D=24
Filtering the sweep for CV in [0.290, 0.292] — the region around the empirically observed binding constant 0.29154 — returns 12 entries:
V
D
CV
24
16
0.2900
368
32
0.2903
1632
24
0.2906
208
24
0.2908
1096
24
0.2911
1992
24
0.2911
200
24
0.2914
1024
24
0.2916
760
24
0.2917
1232
24
0.2917
776
24
0.2919
904
24
0.2920
10 of 12 entries are D=24. The binding constant 0.29154 is the native CV of a 24-dimensional embedding space. It is not a learned value. It is not an empirical coincidence. It is the geometric fingerprint of D=24.
The Computational Boundary
D=24 is also the exact dimension where custom SVD kernels hit an 8x performance cliff and eigendecomposition (eigh) collapses. The binding constant marks a dual boundary:
Geometric: the phase transition between volatile simplex volumes (above 0.30) and discriminative geometry (below 0.30)
Computational: the resolution limit of compact spectral decomposition kernels
Every time the constant 0.29154 appeared across 17+ pretrained models, the system was measuring the dimensional fingerprint of its own computational ceiling. The constellation encoded this ceiling as a structural constant because it could not compute past it.
D=32 is the first dimension past this wall that remains in band (CV ~0.257). Operating there requires torch.linalg.det on a 6×6 CM matrix — which compiles regardless of embedding dimension, because the CM matrix is always 6×6 for five-point simplices. The pairwise distances are computed via gram matrix (batched matmul, compiles perfectly). Only the det call touches linalg, and 6×6 is well within kernel range.
MHA Activation Geometry
Measuring CV on per-head Q/K/V activations (not weights) after training reveals head_dim-dependent geometric behavior:
head_dim
Q activation CV
K activation CV
V activation CV
64
~0.32
~0.42
~0.41
32
~0.38
~0.45
~0.43
16
~0.48
~0.70
~0.53
8
~0.65
~0.77
~0.63
Key observations:
Embedding activations are always in band (CV 0.19–0.30) regardless of nominal D — training compresses effective dimensionality into band
K activations are asymmetrically volatile — keys spread further than queries to make attention discriminative
Q activations track head_dim following the same curve as the embedding sweep — the 64-dim convention keeps Q near band edge
The Q/K ratio measures selectivity pressure: too high = brittle attention, too close to 1.0 = uniform attention
These ratios can be used as a zero-cost diagnostic on any pretrained transformer: forward one batch, measure per-head activation CV, and immediately identify which heads are geometrically healthy vs collapsing.
Vocabulary Independence
CV at D=32 was verified from V=32 to V=13,000,000. The result is invariant:
Vocabulary size does not gate band membership. The CM determinant samples 5 points — the distribution of simplex volumes depends on ambient dimensionality, not on the number of points in the space.
Implications for Architecture Design
The band is not a training outcome. It is a geometric property of dimensionality. This means:
Embedding compartments must be D=32 to D=64 for Cayley-Menger volumes to carry discriminative information
A 768-dim model should decompose into 24×32 or 12×64 compartments, not operate as a monolithic vector
The standard 64-dim attention head may exist precisely because it sits inside this geometric band
Scaling comes from composing band-valid units with geometric linkages, not from widening dimensions beyond the band
D=24 (CV=0.29154) is the phase boundary — any component pushed above this threshold has crossed from structured into volatile geometry
The 6×6 CM determinant compiles at any embedding dimension — the computational bottleneck was in spectral decomposition, not in the geometric measurement itself
Reproducing
python
1# The sweep script that generated this data2# Requires: torch34import torch, torch.nn as nn, torch.nn.functional as F, math, json
56defcayley_menger_vol2(points):7 B, N, D = points.shape
8 gram = torch.bmm(points, points.transpose(1,2))9 norms = torch.diagonal(gram, dim1=1, dim2=2)10 d2 = F.relu(norms.unsqueeze(2)+ norms.unsqueeze(1)-2* gram)11 cm = torch.zeros(B, N+1, N+1, device=points.device, dtype=points.dtype)12 cm[:,0,1:]=1; cm[:,1:,0]=1; cm[:,1:,1:]= d2
13 k = N -114return((-1)**(k+1))* torch.linalg.det(cm.float()).to(points.dtype)/((2**k)*(math.factorial(k)**2))1516defcv_metric(weight, n_samples=300):17 V, D = weight.shape
18 pool =min(V,512)19 idx = torch.stack([torch.randperm(pool)[:5]for _ inrange(n_samples)])20 vol2 = cayley_menger_vol2(weight[:pool][idx])21 valid = vol2 >1e-2022if valid.sum()<10:returnNone23 vols = vol2[valid].sqrt()24return(vols.std()/(vols.mean()+1e-8)).item()
Citation
Part of the GeoLIP geometric deep learning research.