Skip to content

[quantization] Add cached decode calibration for Gemma4 - #1078

Merged
mhs4670go merged 2 commits into
Samsung:mainfrom
mhs4670go:gemma4-decode-calibration
Oct 22, 2026
Merged

mhs4670go merged 2 commits into
Samsung:mainfrom
mhs4670go:gemma4-decode-calibration

Conversation

@mhs4670go

Copy link
Copy Markdown
Contributor

Gemma4 PTQ calibration currently runs only uncached prefill.

Add opt-in prefill followed by exactly D single-token cached forwards through the prepared wrapper so calibration can exercise the cache read path.

Slice text attention masks using the cache's active key span before updates
so cropped sliding keys and shared-KV consumers receive aligned masks.
Keep existing observer and fake-quantization boundaries unchanged.

Add a synthetic prefill plus two cached decode regression with exact mask
checks and parity against a full cache at the existing tolerance.

TICO-DCO-1.0-Signed-off-by: seongwoo <mhs4670go@naver.com>
Resolve the opt-in global count and PTQ stage override consistently for
prompt budgeting and execution, preserving the default prefill-only path.
Run a fresh multimodal prefill and exactly D greedy single-token cached
forwards through the prepared wrapper, with per-token PLE and sample-local
cache/shared state. Validate processed inputs and actual wrapper capacity.

Document the settings and supported padding. Cover control flow, settings,
image routing, cache growth, PLE/shared-KV, sliding attention and conversion
using deterministic CPU recording tests and real tiny Gemma4 wrappers.

TICO-DCO-1.0-Signed-off-by: seongwoo <mhs4670go@naver.com>
@mhs4670go
mhs4670go merged commit 32a8b96 into Samsung:main Oct 22, 2026
9 checks passed
@mhs4670go mhs4670go changed the title Gemma4 decode calibration [quantization] Gemma4 decode calibration Oct 22, 2026
@mhs4670go mhs4670go changed the title [quantization] Gemma4 decode calibration [quantization] Add cached decode calibration for Gemma4 Oct 22, 2026
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