Skip to content

[quantization] Add Gemma4 encoder_with_post vision export - #1151

Merged
mhs4670go merged 2 commits into
Samsung:mainfrom
mhs4670go:gemma4-encoder-with-post
Nov 30, 2026
Merged

mhs4670go merged 2 commits into
Samsung:mainfrom
mhs4670go:gemma4-encoder-with-post

Conversation

@mhs4670go

Copy link
Copy Markdown
Contributor

Keep patch embedding separate and export the complete encoder stack, pooler and full post-projection together with external mask and RoPE inputs. Reuse the prepared components and frozen quantization contracts, and emit a two-stage manifest with one artifact boundary.

Preserve the existing vision layouts, spatial pooling policy, PLE export, compact KV-cache behavior and configuration defaults. Document the new artifacts, input/output contract and CLI override.

Add checkpoint-free float and frozen INT16 eager, torch.export, Circle conversion/reference, boundary-qparam and observer-state tests, plus routing and manifest coverage.

Validation on Samsung/TICO main 60342ce:

  • Export, encoder, config and pooler regressions: 37 tests passed
  • Vision routing regressions: 9 tests passed
  • Real encoder_with_post export suite: 4 tests passed
  • Changed Python files: UFMT, Pylint and mypy passed
  • git diff --check: passed

The full Gemma4 selection was not rerun after rebase. Quantized Circle reference execution uses FAKE_QUANTIZE; full-size checkpoint and native NPU validation were not performed.

TICO-DCO-1.0-Signed-off-by: seongwoo mhs4670go@naver.com

Keep patch embedding separate and export the complete encoder stack,
pooler and full post-projection together with external mask and RoPE
inputs. Reuse the prepared components and frozen quantization contracts,
and emit a two-stage manifest with one artifact boundary.

Preserve the existing vision layouts, spatial pooling policy, PLE export,
compact KV-cache behavior and configuration defaults. Document the new
artifacts, input/output contract and CLI override.

Add checkpoint-free float and frozen INT16 eager, torch.export, Circle
conversion/reference, boundary-qparam and observer-state tests, plus
routing and manifest coverage.

Validation on Samsung/TICO main 60342ce:
- Export, encoder, config and pooler regressions: 37 tests passed
- Vision routing regressions: 9 tests passed
- Real encoder_with_post export suite: 4 tests passed
- Changed Python files: UFMT, Pylint and mypy passed
- git diff --check: passed

The full Gemma4 selection was not rerun after rebase. Quantized Circle
reference execution uses FAKE_QUANTIZE; full-size checkpoint and native
NPU validation were not performed.

TICO-DCO-1.0-Signed-off-by: seongwoo <mhs4670go@naver.com>
Signed-off-by: seongwoo <mhs4670go@naver.com>
The tiny vision profile falls back to matrix pooling even when spatial
pooling is requested. Add focused float and frozen INT16 tests using the
registered default geometry and a small one-layer, one-head encoder.
Reuse the existing vision owner with matching patch size and positional
capacity while preserving its default tiny fixture.

Require the selected spatial profile, active scalar INT16 observers and
exact preservation of quantized pooling coefficients. Inspect the real
composite Circle for AVERAGE_POOL_2D and compare final embeddings against
the separately converted encoder, spatial pooler and full post-projection
on the same reference runtime at rtol=atol=1e-5. Eager composite, split and
monolithic outputs also agree exactly.

Keep the existing tiny-profile tests and production code unchanged.
Quantized reference execution uses FAKE_QUANTIZE; native integer and NPU
execution are not covered.

Validation:
- Focused float and INT16 spatial-composite tests: 2 passed
- Composite, encoder and spatial-pooler regressions: 17 passed, no skips
- UFMT, Pylint and mypy on both changed files: passed
- git diff --check: passed

TICO-DCO-1.0-Signed-off-by: seongwoo <mhs4670go@naver.com>
Signed-off-by: seongwoo <mhs4670go@naver.com>
@mhs4670go
mhs4670go merged commit 00127fd into Samsung:main Nov 30, 2026
13 checks passed
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