Skip to content

Add opt-in centered 2-bit weight quantization (algorithm_params={'centered': True}, default False) to OCTAV, using the 4-level mid-riser grid {-1.5, -0.5, 0.5, 1.5} * scale (zero_point = -0.5, requiring TFLite 2.23+ built-in CPU kernels). - #11771

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
litert_pr_1018485018

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Add opt-in centered 2-bit weight quantization (algorithm_params={'centered': True}, default False) to OCTAV, using the 4-level mid-riser grid {-1.5, -0.5, 0.5, 1.5} * scale (zero_point = -0.5, requiring TFLite 2.23+ built-in CPU kernels).

  • Read centered via uniform_quantize_tensor.get_centered_int2_option, run mid-riser OCTAV clipping, and pre-scale bounds by 0.75 in float64 before tensor_zp_scale_from_min_max so scale = bound / 2.0 matches int2_in_int4=True at half the weight storage.
  • Raise ValueError in hadamard_rotation.get_tensor_quant_params when scale_refinement="mse_grid" is combined with centered INT2.
  • Document "centered" (bool, default false) under algorithm_params in recipes/README.md (with scale_refinement="none" for Hadamard rotation), noting TFLite 2.23+ built-in CPU kernel support versus XNNPACK support for CHANNELWISE dynamic-range FULLY_CONNECTED when "centered": false.
  • Add OCTAV and hadamard_rotation unit tests (including int2_in_int4 parity, multi-axis blockwise, and rejecting scale_refinement="mse_grid" with centered INT2) and end-to-end tests in EMBEDDING_LOOKUP and FULLY_CONNECTED (including two-pass DECOMPOSED_HADAMARD_ROTATION preserving INT2 weights while quantizing rotation matrices to INT8).

@copybara-service
copybara-service Bot force-pushed the litert_pr_1018485018 branch 4 times, most recently from fc57e37 to c6c8a71 Compare November 17, 2026 03:42
@copybara-service copybara-service Bot changed the title Enable centered 2-bit (INT2, zero_point = -0.5, 4 weights/byte) weight quantization by default when num_bits=2 (symmetric=True, signed=True) in MIN_MAX and OCTAV, and align the 2-bit op policy with TFLite runtime kernel support: Add opt-in centered 2-bit weight quantization (algorithm_params={'centered': True}, default False) to OCTAV, using the 4-level mid-riser grid {-1.5, -0.5, 0.5, 1.5} * scale (zero_point = -0.5, requiring TFLite 2.23+ built-in CPU kernels). Nov 17, 2026
@copybara-service
copybara-service Bot force-pushed the litert_pr_1018485018 branch 6 times, most recently from c1bcc08 to 8a224b2 Compare November 19, 2026 23:52
…ntered': True}`, default `False`) to `OCTAV`, using the 4-level mid-riser grid `{-1.5, -0.5, 0.5, 1.5} * scale` (`zero_point = -0.5`, requiring TFLite 2.23+ built-in CPU kernels).

- Read `centered` via `uniform_quantize_tensor.get_centered_int2_option`, run mid-riser OCTAV clipping, and pre-scale bounds by `0.75` in `float64` before `tensor_zp_scale_from_min_max` so `scale = bound / 2.0` matches `int2_in_int4=True` at half the weight storage.
- Raise `ValueError` in `hadamard_rotation.get_tensor_quant_params` when `scale_refinement="mse_grid"` is combined with centered `INT2`.
- Document `"centered"` (`bool`, default `false`) under `algorithm_params` in `recipes/README.md` (with `scale_refinement="none"` for Hadamard rotation), noting TFLite 2.23+ built-in CPU kernel support versus `XNNPACK` support for `CHANNELWISE` dynamic-range `FULLY_CONNECTED` when `"centered": false`.
- Add `OCTAV` and `hadamard_rotation` unit tests (including `int2_in_int4` parity, multi-axis blockwise, and rejecting `scale_refinement="mse_grid"` with centered `INT2`) and end-to-end tests in `EMBEDDING_LOOKUP` and `FULLY_CONNECTED` (including two-pass `DECOMPOSED_HADAMARD_ROTATION` preserving `INT2` weights while quantizing rotation matrices to `INT8`).

LiteRT-PiperOrigin-RevId: 1018485018
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