tenseleyflow/sway / a1d1f32

Browse files

tests/cluster_kl: perturb _dist_broad fixture to clear uniformity guard

Authored by espadonne
SHA
a1d1f3268049e72825d9aa538573ad57c3978426
Parents
27a65fa
Tree
c66d995

1 changed file

StatusFile+-
M tests/unit/test_probe_cluster_kl.py 4 1
tests/unit/test_probe_cluster_kl.pymodified
@@ -38,9 +38,12 @@ def _dist_sharp(seed_offset: int = 0) -> TokenDist:
3838
 
3939
 
4040
 def _dist_broad() -> TokenDist:
41
-    """Broad distribution: uniform over top-k."""
41
+    """Broad distribution: uniform over top-k, with a tiny monotonic
42
+    perturbation so it clears ``_divergence``'s uniformity guard (a
43
+    literally-flat dist looks like a broken lm_head)."""
4244
     k = 8
4345
     lp = np.full(k, -math.log(k), dtype=np.float32)
46
+    lp += np.linspace(-1e-4, 1e-4, k, dtype=np.float32)
4447
     residual = 1.0 - float(np.exp(lp).sum())
4548
     tail = math.log(residual) if residual > 1e-12 else None
4649
     return TokenDist(