You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Matryoshka-aware working_dim truncation (EmbeddingGemma et al.) #24
We already benchmark with EmbeddingGemma 300M (768-dim), which is Matryoshka-trained (truncatable to 512/256/128/64 with graceful recall decay). Consumers using such models can quantize only the leading working_dim dimensions: less storage, less scan compute, near-full recall. Backed by When Is 0.1% Enough? Dimensionality Reduction + Quantization of Text Embeddings.
Design
Truncate BEFORE rotation. RHDH mixes dimensions, so truncating rotated dims is not equivalent. Pipeline: unit(v[..working_dim]) → pad to padded_dim(working_dim) → RHDH → 4-bit.
API: VecqIndex::with_working_dim(dim, working_dim, seed) (working_dim <= dim, default = dim). Queries use a matching prepare_query_truncated or the same truncation documented for callers.
Search returns scores comparable only within the same working_dim (document — not comparable to full-dim indexes).
Acceptance
Recall table: full-dim vs working_dim ∈ {512, 256, 128} on the benchmark dataset (expect graceful decay per Matryoshka property)
Size table: bytes/vec at each working_dim
Cross-platform determinism tests unchanged (seed still in header)
docs/README: Matryoshka recipe incl. which dims consumer models support
Dependencies
Independent, small-medium effort. High user value (we use Matryoshka models ourselves). Candidate for v0.3.0.
Activity
feat(core): Matryoshka-aware working_dim truncation (#30)
chore: release v0.3.0 to main (#46)
chore: release v0.3.1 to main (#55)