Skip to content

[ABA-15] fix(vortex-turboquant): use 6-σ centroid init to prevent 2-bit collapse at padded_dim=2048#7

Open
abnobdoss wants to merge 2 commits into
developfrom
fix/aba-15-turboquant-6sigma-init
Open

[ABA-15] fix(vortex-turboquant): use 6-σ centroid init to prevent 2-bit collapse at padded_dim=2048#7
abnobdoss wants to merge 2 commits into
developfrom
fix/aba-15-turboquant-6sigma-init

Conversation

@abnobdoss
Copy link
Copy Markdown
Owner

Summary

  • Bug: At padded_dim >= 2048, bit_width=2, the Max-Lloyd centroid initializer places starting points at [-0.75, -0.25, 0.25, 0.75] (uniform on [-1,1]). The marginal pdf (1 - x²)^((d-3)/2) underflows to ~0 outside |x| ≈ 0.1 at these dimensions. The trapezoidal integrator returns denominator < 1e-30 for outer Voronoi cells; the guard returns the cell midpoint; outer centroids never converge. Result: 2-bit quantizer silently degrades to 1-bit fidelity.
  • Fix: Replace uniform [-1, 1] init with bounded [-W, W] where W = min(1, 6/sqrt(d)). Initializes all centroids inside the numerically representable pdf support.
  • Two-commit structure (TDD): test first (RED), then fix (GREEN).

Linear

Closes ABA-15

Validation

  • Regression test added: issue_aba15_centroids_dont_collapse_at_padded_dim_2048_bit_width_2 — asserts max|centroid| < 0.5 for (dim=2048, bit_width=2).
  • Test confirmed FAIL on buggy develop (max|c| = 0.6725), PASS after fix.
  • All 77 existing vortex-turboquant unit tests pass post-fix.
  • Pre-verified against /tmp/tq-72/vortex-turboquant-fix/ — the fix patch applied cleanly with no divergence from develop.
  • cargo fmt (stable) applied.

🤖 Generated with Claude Code

Abanoub Doss and others added 2 commits May 21, 2026 08:13
…at padded_dim=2048

Adds a regression test that catches the uniform [-1,1] centroid
initialisation bug described in vortex#7245 / ABA-15.

At padded_dim=2048, bit_width=2, the marginal pdf (1 - x²)^((d-3)/2)
is so sharply peaked near zero that outer Voronoi cells have a numerical
integral of ~0. The denominator < 1e-30 guard returns the cell midpoint,
outer centroids get stuck near ±0.75, and the quantizer silently
degrades to 1-bit fidelity.

The test asserts max|centroid| < 0.5 — which fails on the buggy init and
passes after the 6-σ fix.

Signed-off-by: Abanoub Doss <abanoub.doss@gmail.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Abanoub Doss <abanoub.doss@gmail.com>
…llapse

Fixes ABA-15 / vortex#7245.

Replace uniform [-1, 1] centroid initialization with a bounded
[-W, W] initialization where W = min(1, 6/sqrt(d)).

At high padded dimensions (d >= 2048), the marginal pdf
(1 - x^2)^((d-3)/2) is sharply concentrated near zero with effective
std-dev sigma = 1/sqrt(d). A uniform [-1, 1] init places centroids far
outside the pdf support, causing the trapezoidal integrator to return
denominator ≈ 0 for outer Voronoi cells. The 1e-30 guard then returns
the cell midpoint, outer centroids never converge, and bit_width=2
silently degrades to 1-bit fidelity.

The 6-sigma bound ensures all initial centroids fall within the
numerically representable pdf support, allowing Max-Lloyd to converge
to distinct centroids for all bit widths at any valid dimension.

Pre-verified against the vortex-turboquant test suite at /tmp/tq-72/.

Signed-off-by: Abanoub Doss <abanoub.doss@gmail.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Abanoub Doss <abanoub.doss@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant