Repository navigation
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
Open
copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
copybara-service
Bot
force-pushed
the
litert_pr_1018485018
branch
4 times, most recently
from
November 17, 2026 03:42
fc57e37 to
c6c8a71
Compare
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: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).
copybara-service
Bot
force-pushed
the
litert_pr_1018485018
branch
6 times, most recently
from
November 19, 2026 23:52
c1bcc08 to
8a224b2
Compare
…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
copybara-service
Bot
force-pushed
the
litert_pr_1018485018
branch
from
November 23, 2026 20:06
8a224b2 to
c06f116
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add opt-in centered 2-bit weight quantization (
algorithm_params={'centered': True}, defaultFalse) toOCTAV, 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).centeredviauniform_quantize_tensor.get_centered_int2_option, run mid-riser OCTAV clipping, and pre-scale bounds by0.75infloat64beforetensor_zp_scale_from_min_maxsoscale = bound / 2.0matchesint2_in_int4=Trueat half the weight storage.ValueErrorinhadamard_rotation.get_tensor_quant_paramswhenscale_refinement="mse_grid"is combined with centeredINT2."centered"(bool, defaultfalse) underalgorithm_paramsinrecipes/README.md(withscale_refinement="none"for Hadamard rotation), noting TFLite 2.23+ built-in CPU kernel support versusXNNPACKsupport forCHANNELWISEdynamic-rangeFULLY_CONNECTEDwhen"centered": false.OCTAVandhadamard_rotationunit tests (includingint2_in_int4parity, multi-axis blockwise, and rejectingscale_refinement="mse_grid"with centeredINT2) and end-to-end tests inEMBEDDING_LOOKUPandFULLY_CONNECTED(including two-passDECOMPOSED_HADAMARD_ROTATIONpreservingINT2weights while quantizing rotation matrices toINT8).