Skip to content

feat: expose random rotation for INT8/INT4 quantization (closes #177) - #186

Merged
s2x merged 1 commit into
mainfrom
feat/issue-177-quantizer-enable-rotate
Aug 8, 2026
Merged

feat: expose random rotation for INT8/INT4 quantization (closes #177)#186
s2x merged 1 commit into
mainfrom
feat/issue-177-quantizer-enable-rotate

Conversation

@s2x

@s2x s2x commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Description

Closes #177

Exposes zvec v0.6.0 random rotation for INT8/INT4 quantization (upstream alibaba/zvec#483) — a measured recall win on quantized indexes (e.g. Flat INT8: 0.9695 → 0.9881).

Changes

  • FFI: new zvec_index_params_set_quantizer_enable_rotate(); IndexParamsHolder::build() applies QuantizerParam(enable_rotate) to HNSW, Flat, IVF, and Vamana params (silent no-op for non-vector types — documented divergence from upstream C API which returns INVALID_ARGUMENT)
  • PHP: fluent ZVecIndexParams::setQuantizerEnableRotate(bool) mirroring upstream C API / Python SDK enable_rotate naming
  • Tests: tests/test_quantizer_enable_rotate.phpt — HNSW/Flat/IVF/Vamana with QUANTIZE_INT8 + rotation, no-rotation default, QUANTIZE_UNDEFINED no-op case
  • Docs: README example + CHANGELOG entry

Testing

  • Builds locally (FFI)
  • All .phpt tests pass (173 passed, 0 failed; run with php run-tests.php -n tests/)
  • No test database leftovers

Code Review

  • Passed subagent code review (2 rounds — findings addressed: Vamana coverage, divergence comment)
  • All review comments addressed

- Add zvec_index_params_set_quantizer_enable_rotate to FFI bridge
- Wire QuantizerParam(enable_rotate) through IndexParamsHolder::build()
  for HNSW, Flat, IVF, and Vamana indexes (silent no-op for non-vector types,
  mirroring upstream C API semantics)
- Add fluent ZVecIndexParams::setQuantizerEnableRotate(bool) to PHP API
- Add tests/test_quantizer_enable_rotate.phpt covering HNSW/Flat/IVF/Vamana
  with QUANTIZE_INT8 + rotation and QUANTIZE_UNDEFINED no-op case
- Update README and CHANGELOG
@s2x s2x self-assigned this Aug 8, 2026
@s2x
s2x merged commit c640d74 into main Aug 8, 2026
3 checks passed
@s2x
s2x deleted the feat/issue-177-quantizer-enable-rotate branch August 8, 2026 13:54
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.

Expose random rotation for INT8/INT4 quantization (zvec v0.6.0)

1 participant