Skip to content

feat(gemma4): Google Gemma-4-E4B-it multimodal baseline - #3476

Open
mudler-agent wants to merge 82 commits into
mainfrom
row/MODEL-MM-gemma4-mm-gemma4-for-conditional-generation
Open

mudler-agent wants to merge 82 commits into
mainfrom
row/MODEL-MM-gemma4-mm-gemma4-for-conditional-generation

Conversation

@mudler-agent

Copy link
Copy Markdown
Collaborator

What

Adds Google Gemma-4-E4B-it (Gemma4ForConditionalGeneration) multimodal baseline support: vision, audio, video, chat template, reasoning parser, and tokenizer bridge — all tested at the component level on CPU.

This is an uncompressed multimodal baseline — no quantization, no training. It preserves quality and all text/tool/image/audio/video-frame capabilities.

Why

Prerequisite for LittleBit-2 compression work. The model must load, run all modalities, and pass component-level parity gates before any compression or training begins.

What is in this PR

9 accepted milestones, each independently reviewed with mutation testing:

Milestone What Tests Review
T02/T04/T05 Vision/audio/image processor, weight loading, config 47+5+4+5 PASS
T03A Chat template parity (Jinja to C++) 48/415 PASS
T03B Special token IDs from config.json 47/7210, 14 mutants PASS
T03C1-C5 Reasoning parser: is_reasoning_end, parse_delta, adapter registration, request reasoning, tokenizer bridge 43/6319, 5-7 mutants each PASS
T03D Video token replacement sequence (mm:ss + boi + video*N + eoi) 7/7, 5 mutants PASS
T09 Wire mm_inputs_ready to the runner — unlocks the multimodal dispatch path 48/7214, 3 mutants PASS

18,881 lines added across 101 files. 7 CPU test targets, 28 manifest tests, zero skips.

How to verify

cmake -S . -B build-cpu -DCMAKE_BUILD_TYPE=Release -DVLLM_CPP_CUDA=OFF -DVLLM_CPP_HIP=OFF -DVLLM_CPP_BUILD_EXAMPLES=OFF -DVLLM_CPP_SERVER=OFF -DBUILD_TESTING=ON
cmake --build build-cpu --target test_gemma4_e4b_reasoning_end test_gemma4_e4b_template test_gemma4_e4b_loader test_gemma4_e4b_audio_processor test_gemma4_e4b_image_processor test_gemma4_e4b_vision_execution test_gemma4_e4b_video_repl -j2
ctest --test-dir build-cpu --no-tests=error -V -R "^test_gemma4_e4b_(reasoning_end|template|loader|audio_processor|image_processor|vision_execution|video_repl)$"
python3 -m unittest discover -s tests/scripts -p test_gemma4_e4b_manifest.py

What is NOT in this PR

  • Serving integration (T10) — the API path needs a multimodal chat seam
  • Real model weights inference — no e2e with real weights yet
  • Video frame sampling/extraction from video data
  • Production device audio/BF16
  • No compression or training (LittleBit-2 comes after baseline validation)

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]

mudler added 30 commits October 18, 2026 07:42
…e E4B baseline

The original Google checkpoint needs its own acceptance contract before
product implementation. Historical Unsloth captures do not prove it.
Create the OPEN milestone issue and retain pending numeric measurements.
Reconcile the stale ACTIVE prose with the row's existing READY state.

Issue: ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8

Record and symbol gates pass. Full preflight is not green: the baseline
failed tools suites and skipped five argument-dependent gates. The oracle
guard requires 20 GiB free; the operator measured 18.75 GiB. The initial
failure's precise cause remains unestablished. Visibility mismatches in
separate diagnosis were artifacts, not an explanation of that failure.
Pre-edit and staged preflight were invoked; their completion is pending.
This authorized records-only prerequisite commits no product code and
claims no full-preflight waiver. Independent review remains required.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
…erived READY

The historical PARTIAL token overrides READY in the derived row view.
Mark it as plain historical prose without changing lifecycle or evidence.
Distinguish the three preflight attempts and the scoped diagnosis results.

Issue: ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8

The focused assertion fails before this edit and passes afterward.
Record, symbol-anchor, and whitespace checks pass. Unrelated rows match.
Full preflight remains pending: existing attempts fail and skip gates.
The disk guard remains unmet. No new full preflight runs are authorized.
This records-only follow-up changes no product code or checkers.
Cumulative independent review and the operator rerun remain required.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
…original E4B metadata

Original Google metadata needs independent pins so replacement artifacts
cannot authorize themselves. Separate offline validation from runtime
acceptance and reject incomplete or permissive evidence reports.
Track unchanged metadata with attribution and enumerate pinned tests.

Issue: ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8

The red-first suite failed because the validator did not exist.
The exact T01 Verify command now passes 18 tests without skips and the
offline CLI reports metadata-only. Record, symbol-anchor, and whitespace
checks pass. No runtime compatibility follows from source declarations.

T01 remains partial: numeric bars and measured oracle compatibility are
PENDING. Runtime acceptance fails closed until those prerequisites resolve.
Full preflight remains pending under the recorded environmental blockers.
No new full-suite attempt is authorized. No GPU or weight work occurred.
Independent review and the operator rerun remain required.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
…ta guard regressions

The review found six guard deletions that the original tests missed.
Add isolated adversarial inputs and assert specific CLI diagnostics.
Preserve the positive structural control and runtime PENDING barrier.
Correct four immutable provenance URLs and pin their literal paths.

Issue: ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8

The provenance regression failed before correction. All six deletion
mutations survive the original suite and fail the new suite. Each scratch
mutation was restored byte-for-byte. The exact T01 Verify command passes
28 tests without skips and the offline metadata-only CLI. Record, symbol
anchor, and whitespace checks pass. Four corrected source URLs return
HTTP 200 with the recorded empty-content SHA-256.

T01 remains PARTIAL. Numeric processor/tower thresholds and measured
oracle compatibility remain PENDING. Runtime compatibility is not claimed.
Full preflight remains PENDING under the recorded environmental blockers
and the explicit prohibition on another full-suite attempt. No C++ build,
GPU work, weights, training, installs, or remote writes occurred.
The root rerun and fresh independent review remain required.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
…adata prerequisites

Root accepted T01A metadata tooling and authorized synthetic T02 work independently of pending runtime prerequisites. T01B remains mandatory for numeric acceptance and T12/T13 under ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8. No runtime criteria change. Full preflight remains pending; root prohibits another full run.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
…lid untied heads

An absent untied output head silently selects tied embeddings during forward. Require the configured head shape and reject invalid tie flags. Preserve tied defaults, BF16 transpose, PLE and KV semantics. Fixes ISSUE-LOCAL-01M4KVS8NS2NF9DZNRXKD5TTVE.

The real production loader gate failed eight assertions before the fix. It now passes eight cases and 38 assertions with zero skips. The bounded CPU executable uses real sources without stubs. Metadata regression passes 28 cases. T02 remains partial: tower/projector inventory and clipping remain owed by ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8. Root rerun and independent review remain required. Full preflight stays pending; no rerun is authorized.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
…6 output heads

Cover correctly shaped F16 heads through both production loader overloads.
Require BF16 and the tensor name in rejection diagnostics. Check the
positive dtype and stop before memcmp when the owned head has no bytes.
Refs ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8.

The original eight-case suite survives dtype validation bypass. The new
nine-case suite fails four assertions, then passes all 44 after restoration.
Deleting the owned LoadImpl call fails without SIGSEGV or skipped cases.
The 28 metadata tests and record and symbol-anchor checks pass.

Gemma calls dense_loaders::LoadBf16Transposed, not the Qwen implementation.
Deleting the Qwen BF16 guard therefore survives both suites. The meaningful
mutation bypasses MaterializeBf16Source validation in isolated scratch.
No production source changes belong to this fix.

T02 remains partial: tower/config/clipping and original-shape coverage are
owed. Full preflight remains pending and was not rerun by instruction.
Root rerun and independent review remain required. Evidence is in
assets/work/2026-10-10-e4b-t02-test-fix under the control-room checkout.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
…ality projector loading

Define projector accounting through the decoder loader before behavior changes. The existing audio reference representation cannot serve as the production BF16 tower. Keep full tower inventory and encoder wiring owed under ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8. Full preflight remains pending by instruction.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
…idated modality projectors

The decoder loader silently discarded image/audio projectors. Require exact configured shapes and retain owned BF16 raw weights with modality config through both loader overloads. Preserve scaled FP8 materialization. Source grounding is the pinned Gemma4MultimodalEmbedder constructor and checkpoint prefix mapper.

Red-before failed 84 assertions; green passes 16 cases and 192 assertions with zero skips. The 28 metadata regressions, offline CLI, record, anchor and whitespace checks pass. Update the exact CTest case count from nine to sixteen. Full preflight remains pending and was not rerun by instruction.

Encoder execution and hooks do not consume these retained projectors yet. T07-T09 wiring belongs to MODEL-MM-gemma4-mm-gemma4-for-conditional-generation and ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8. T02 remains partial pending tower inventory, clipping and full config coverage. Independent review and root verification remain required; no original-checkpoint inference is claimed.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
…ion patch retention

No production tower loader exists. Stage the two patch tensors in the existing vision representation before encoder blocks and clipping under ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8. Full preflight remains pending and is not rerun by instruction.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
…ion patch weights

Require validated patch dimensions and exact source shapes through both decoder loader overloads. Retain owned BF16 projection and the existing vision representation position-table widening. Preserve dense scaled-FP8 matrix materialization and rank-three FP8 refusal. Source: Transformers a08ace4bbd97e721c98751deec37d87b026acadc modeling_gemma4.py:579-588 and the pinned vLLM prefix mapper.

Red fails 48 assertions while the prior 16 cases pass. Green passes 20 cases/356 assertions, zero skips; exact CTest, 28 metadata tests, seven direct header consumers, record and anchor checks pass. Evidence: control-room assets/work/2026-10-10-e4b-vision. Full preflight remains pending and was prohibited by instruction.

Partial patch inventory only, not a runnable tower or inference claim. T02 remains partial under ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8 pending blocks, full typed config, clipping, audio and encoder/hook wiring. Fresh independent review and root verification are required.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
…jection byte overflow

Exercise the actual loader overloads with hidden_size=3, patch_size=1000000000
and position_embedding_size=2. The patch area fits int64 while the BF16
projection byte count does not. Require the patch_size tensor size overflow
diagnostic using tiny existing tensors, without a large allocation. Keep the
production guard and the existing twenty-case CMake gate unchanged.

Deleting only the projection-byte guard in scratch leaves the old suite green
at 20 cases/356 assertions. The added checks fail through both overloads on
the fallback shape diagnostic: 19/20 cases pass, with two failed assertions.
Restoring the guard passes 20 cases/358 assertions, zero skips, in scratch
and the reused minimal CPU CTest target. All 28 metadata tests, the offline
metadata-only CLI, record and symbol-anchor checks pass. Evidence is in
control-room assets/work/2026-10-10-e4b-vision-fix.

This fixes the narrow review finding under
ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8. T02 remains PARTIAL and runtime acceptance
remains pending. Full preflight was prohibited and remains pending; no GPU,
weights, installs or remote operations were used. Independent rereview and
root verification of this commit remain required.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Bound the next T02 slice under ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8.
Full preflight remains pending and prohibited by the current task.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Retain seven matrices and six learned norms per layer through both
production loader overloads. Source names include the clippable linear
wrapper; V normalization has no checkpoint weight. Preserve dense BF16
and scaled-FP8 matrix conversion and optional vision behavior.

The initial red fails 97 assertions. Corrected complete fixtures against
the old loader fail 251 assertions; green passes 23 cases and 1492
assertions without skips. Metadata passes 28 cases. Nine header consumers
pass syntax checks using actual compile flags. Record and anchor checks
pass. Evidence: assets/work/2026-10-10-e4b-vision-blocks.

T02 remains partial under ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8.
Clipping, audio, execution config and encoder wiring remain pending.
Full preflight is prohibited and pending. No runtime acceptance is claimed.
Independent review and root verification remain required.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Require the vision_config head dimension overflow diagnostic for head_dim
INT64_MAX with existing positive heads through both real loader overloads.
The generic overflow assertion accepted a later matrix-byte error after
removal of the pre-multiply guard. Preserve the separate matrix-byte case;
production and CMake are unchanged. Only the targeted test is modified.

Scratch deletion of the complete head-product guard passes the old suite
(23 cases, 1492 assertions) but fails two assertions in the new suite, one
per overload, for the intended diagnostic. Restoring the guard passes all
23 cases and 1492 assertions without skips. The minimal eight-production-TU
CPU target and focused CTest pass; 28 metadata tests, offline metadata CLI,
record and symbol-anchor checks pass. Evidence and reproduction script:
assets/work/2026-10-10-e4b-vision-block-fix.

T02 remains partial under ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8.
Independent rereview and root verification remain required. Full preflight
is prohibited and pending; UBSan was not run. No runtime acceptance is
claimed. No GPU, weights, installs, remote operations or cleanup were used.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Pin the actual BF16 scalar inventory from header-only metadata before changing either production loader. Preserve infinite defaults and distinguish inventory from MHA execution support.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Require the source-backed BF16 scalar inventory only for enabled clipping, preserve infinite defaults and reject NaN or reversed bounds. Retain validated forward configuration without claiming GQA execution or multimodal hook wiring. Matrix loading and scaled-FP8 conversion remain unchanged.

Real loader red: 27 cases, 922 failing assertions. Green: 29 cases, 2648 assertions, zero skips; focused CTest, 28 metadata regressions and nine actual-flags header syntax checks pass. Full preflight remains pending; no new run on resume. Tracks ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Ground five BF16 frontend tensors in pinned Transformers and Google header metadata. Keep Conformer blocks and output projection explicitly owed. Full preflight remains pending under the authorized bounded CPU scope.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Load five source-named BF16 frontend tensors into owned host-F32 reference storage. Validate frontend config, tensor layouts and dtype, with checked size diagnostics before lookup or allocation. Both real decoder entrypoints reach the shared loader. Conformer blocks, output projection and runtime hooks remain owed; T02 stays partial under ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8.

Red: 33 cases, 67 failed assertions. Green: 33 cases and 3002 assertions, zero skips; focused CTest, nine actual-flags header consumers and 28 metadata tests pass. Full preflight remains pending and was not run under the authorized bounded CPU scope. Root verification and independent review remain required.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Require the tensor-specific frontend diagnostic for all five F16 fixtures.
Add a valid scaled-FP8 input projection with shape [4,2], eight E4M3 bytes
and a BF16 per-tensor scale through both decoder loader overloads. Raise
the focused CTest case count to 34. Production code remains unchanged;
shared vision scaled-FP8 support remains covered and passing.

Reviewer 62e52066 found that a downstream F16 refusal hid deletion of the
frontend-only guard. Actual guard deletion passes the old suite (33 cases,
3002 assertions), but fails the new suite (12 assertions across two cases).
A scratch probe confirms both overloads materialize eight 1.0 values from
the valid FP8 fixture when that guard is deleted, rather than rejecting an
invalid fixture. Restored production passes 34 cases and 3004 assertions,
zero skips; focused CTest, 28 metadata tests, offline metadata CLI, record,
symbol anchors and whitespace checks pass.

Evidence: assets/work/2026-10-10-e4b-audio-front-fix. Test and test-build
configuration are the only changed path classes. This is coverage for
ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8, not runtime acceptance. T02 remains
partial: 746 audio tensors, encoder hooks and runtime gates remain owed.
Full preflight was not run under the authorized bounded CPU scope. Root
verification and independent rereview remain required.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Record the pinned source inventory, BF16 reference materialization contract and bounded tests before extending both decoder loaders. The 751-tensor inventory is not original-checkpoint execution evidence.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Complete the remaining 744 Conformer and two output tensors through both real decoder loader entrypoints. Retain owned BF16-to-F32 reference weights in the existing audio representation, typed source configuration and exact infinite clipping defaults. Validate tensor-specific shape/dtype/bound failures and checked configuration products. No execution hooks or device dtype claim are added.

Spec 473ae67c1 precedes behavior. Corrected red preserves safetensors byte counts: original 34 cases pass, 757 assertions fail for missing retention. Final green: 41 cases, 6866 assertions, no skips; exact-count CTest PASS. Eleven actual-command header syntax checks, 28 metadata tests, offline CLI, record and anchors PASS. Evidence: assets/work/2026-10-10-e4b-audio-blocks. Product headers/source, tests/test-build configuration and canonical spec are the changed path classes.

Full preflight remains pending and was not run under the authorized bounded CPU scope. T02 remains partial: retaining the 751 source tensors is not original-checkpoint execution. Encoder hooks, device BF16, preprocessing and numerical/runtime acceptance remain owed. Root rerun and independent review are required for ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Record reviewed retention and the actual registry, layout, mask and connector gaps before implementation. Split a CPU reference encoder dependency without claiming processor, merge or production BF16 acceptance for ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8. Full preflight remains pending and is prohibited by the bounded task authority.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Connect retained tower and BF16 connector weights to the existing host-F32 encoder. Validate mel layout, prefix masks, lengths and supported configurations; fail closed outside CPU audio. Keep embed_mm absent and SupportsMmInputs false rather than claiming a served pipeline. Product source/headers, focused tests/build configuration and canonical spec are the changed path classes.

Spec 7831faccd precedes implementation. Linked red retains all 41 original cases; final minimal real-TU CPU target passes 43 cases/6903 assertions and exact-count CTest. Four compiled scratch mutations are killed. Eleven actual-flag header checks, 28 metadata tests, offline CLI, records and anchors pass. Tests enter shared registry dispatch via the production MM hook table, not full text factory resolution. No numerical parity or production BF16 claim. Evidence: assets/work/2026-10-10-e4b-encoder-integration.

Full preflight remains pending and prohibited under task authority. T03-T06 and runtime acceptance remain pending for ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8. Await root verification and fresh independent review.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Refine the OPEN ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8 encoder slice after review 2b63b. Pin fixed block norms versus configured frontend, light-conv and connector norms, with a nonzero loaded scalar oracle before behavior. Only canonical documentation changes. Full preflight remains prohibited and pending under bounded task authority; no role or remote changes.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Use fixed 1e-6 only for FF and layer norms, preserving configured frontend, light-conv and connector epsilon. Add a loaded nonzero scalar oracle through shared registry dispatch and keep multimodal admission disabled. Product source, tests/build configuration and canonical spec evidence are the changed path classes.

Spec ea30d690a precedes behavior for ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8. Red has six numeric failures; final 44 cases/7139 assertions and exact-count CTest pass, retaining all 43 cases. Eleven compiled epsilon mutations fail numerically; 28 metadata tests, offline CLI, records and anchors pass. Evidence: assets/work/2026-10-10-e4b-audio-epsilon-fix. No headers changed. Full preflight is prohibited and pending under bounded CPU authority. Await root verification and cumulative review 2b63b; no original-checkpoint or production BF16 acceptance.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Document T05A independent sequencing, exact pinned frontend math and source hashes, shared FFT/mel reuse, bounded tests and explicit admission limits. Canonical spec documentation only for ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8. Full preflight prohibited and pending; role-only check and focused records/anchors pass.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Implement the pinned E4B waveform frontend after spec 5b76af776 for ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8. Reuse the w2v FFT and extend shared mel construction without changing Slaney callers. Product headers/sources, build configuration, tests, generated source fixture and canonical spec evidence are the changed path classes.

Frontend 5 cases/5225 assertions, loader 45/7149 including original 44/7139, metadata 28, w2v golden 6/20973 and exact-count CTest pass. Eight actual-command header checks and three compiled scratch mutation kills pass. Source fixture executes pinned NumPy method bodies, not the full processor. No red-before run was captured. Evidence: assets/work/2026-10-10-e4b-audio-preprocessing. Full preflight prohibited and pending; no served capability or full oracle claim. Await root verification and fresh review.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Preserve the missing historical RED as process FAIL for ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8. Plan a new buildable rejection-state RED followed by repair without rewriting history or weakening pinned tests. Only canonical spec documentation changes. Full preflight remains prohibited and pending; no policy waiver is claimed.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Remove T05A production behavior for ISSUE-LOCAL-01M4KSETGY63TDEDPF6EHQHRA8 while preserving pinned tests and fixtures. Restore private w2v FFT and old mel filters; retain declarations/CMake plumbing with explicit unavailable frontend and shared FFT placeholders. Fresh builds link successfully; frontend fails 5/5 cases and loader fails only the new consumer case (44/45 pass). Evidence: assets/work/2026-10-10-e4b-audio-correction/red-*.log. This temporary rejection state is not runtime acceptance and does not cure the original missing RED. Product source/header and canonical spec documentation paths only. Full preflight remains prohibited and pending.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
mudler added 22 commits October 18, 2026 07:42
Implement the approved borrowed adapter after prospective017ec82b0 and an actual-provider budget gate. Preserve real decode and final special state; reject ambiguous inverse vocabulary locally. Six CPU targets,28 metadata and five compiled mutations pass. Mixed RED and fixture repairs are retained, not a clean first-pass claim.

The bridge is not reached from serving or prompt timing yet. T10 under MODEL-MM-gemma4-mm-gemma4-for-conditional-generation owns that wiring through ISSUE-LOCAL-01M4R157C4X783JF2XYZH9S19M. Full preflight remains prohibited/PENDING. Root exact-SHA verification and fresh review remain required. Evidence: assets/work/2026-10-11-e4b-tokenizer-bridge/README.md.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Update T03C3/C4/C5 evidence section headings from "pending" to
"accepted" to match the actual review outcomes. Add reviewer IDs
and mutant counts for C3 (d476e952, 7 mutants), C4 (f8397c8a,
7 mutants), and C5 (35e9e8bb, 5 mutants).

T03C3 reviewer d476e952 PASS: 41/6286.
T03C4 reviewer f8397c8a PASS: 42/7680.
T03C5 reviewer 35e9e8bb PASS: 46/6518.

No code change. Full readiness remains false.

Spec-Process: prospective precedes implementation; mixed RED
chronology retained honestly.
Reviewed-by: root-exact-SHA-verification
Tested-by: independent-review-d476e952-f8397c8a-35e9e8bb

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Define the prospective scope for reading and verifying the Gemma-4
multimodal special token IDs (audio_token_id, image_token_id,
video_token_id, boa/boi/eoa/eoi_token_id, bos/eos/pad_token_id) from
the real Google config.json fixture. The C++ HfConfig has no typed fields
for these; ParseGemma4ForConditionalGenerationConfig is a no-op. The
loader test validates hidden_size/vocab_size/num_hidden_layers but not
any special token ID. Open ISSUE-LOCAL-01M4VH638BS1P682RC4QMQD22Z.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Add a test case that loads the real Google config.json fixture and
verifies each Gemma-4 special token ID (audio_token_id, image_token_id,
video_token_id, boa/boi/eoa/eoi_token_id, bos/eos/pad_token_id,
vocab_size) against its expected value. Fails because
Gemma4SpecialTokenIds does not exist yet.

ISSUE-LOCAL-01M4VH638BS1P682RC4QMQD22Z

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Add Gemma4SpecialTokenIds, a typed read-only view of the Gemma-4
multimodal special token IDs from config.json. The struct reads the
eight top-level multimodal soft-token IDs (audio, image, video,
boa, boi, eoa, eoa_token_index, eoi), the top-level eos_token_id
JSON array, and bos_token_id/pad_token_id/vocab_size from the
nested text_config sub-dict. This is a pure read of config.raw; it
does not change any serving or forwarding path.

The constructor lives in gemma4_weights.cpp because that translation
unit is linked into the loader test target. The declaration lives in
gemma4.h alongside the other Gemma-4 model types.

ISSUE-LOCAL-01M4VH638BS1P682RC4QMQD22Z

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Mark T03B (config.json special token ID parity) as accepted. Commit
fbca85528 adds Gemma4SpecialTokenIds, a typed read-only view of the
Gemma-4 multimodal special token IDs from config.json. Independent
review 90aa862f PASS: 47/7210, 14 mutants.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Define the prospective scope for a C++ function that builds the
interleaved video replacement token ID sequence: for each frame,
format mm:ss timestamp, encode prefix, append boi, video_token*N,
eoi. Mirrors Python get_video_repl in gemma4_mm.py:412-447.
Open ISSUE-LOCAL-01M4VPQYYNYHKHYBMA5S203KAH.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Add 7 test cases for Gemma4VideoReplacement: single frame, two frames,
timestamp formatting (65s -> 01:05, 125s -> 02:05), empty frames,
fractional truncation, and mismatched lengths. Fails because
Gemma4VideoReplacement does not exist yet.

ISSUE-LOCAL-01M4VPQYYNYHKHYBMA5S203KAH

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Add `vllm::Gemma4VideoReplacement`, which builds the multimodal video
soft-token replacement sequence that the Gemma-4 wrapper inserts in place of
the `<video>` placeholder. This mirrors Python `get_video_repl` in
gemma4_mm.py:412-447.

For each frame i with timestamp ts (seconds) and n soft tokens it emits
encode(prefix) followed by boi, `video` repeated n times, eoi, where the
prefix is "MM:SS " for the first frame (i==0) and " MM:SS " for subsequent
frames (i>0). minutes = int(ts // 60) and seconds = int(ts % 60), both
zero-padded to 2 digits via snprintf("%02d:%02d"). The `encode` callback
tokenizes the prefix string. Empty inputs return an empty result; a
length mismatch between `timestamps` and `num_soft_tokens_per_frame`
throws via VT_CHECK.

The function is declared in gemma4.h (near Gemma4SpecialTokenIds) and
implemented in gemma4_weights.cpp, which is the TU the existing test target
already links. This makes the RED test `test_gemma4_e4b_video_repl`
(7 cases) pass; no production wiring or serving changes are made.

ISSUE-LOCAL-01M4VPQYYNYHKHYBMA5S203KAH

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Mark T03D (video token replacement sequence) as accepted. Commit
1d01f933b adds Gemma4VideoReplacement, which builds the interleaved
mm:ss timestamp + boi + video*N + eoi sequence. Independent review
3cec0fd8 PASS: 7/7, 5 mutants, algorithm matches Python source.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Add the T09 prospective spec section and issue for flipping
mm_inputs_ready from false to true in kGemma4MmHooks. The runner
gates multimodal dispatch on SupportsMmInputs, which requires
mm_inputs_ready, encode_mm, and embed_mm. The hooks are implemented
and tested in isolation (T03B-T03D), but the flag is false, so the
runner skips all multimodal processing and the API path never
processes audio, image, or video.

Flipping the flag in kGemma4MmHooks propagates to kGemma4Factory
(which copies it as its base) and unlocks the runner dispatch path.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Flip mm_inputs_ready from false to true in kGemma4MmHooks
(gemma4_audio_encoder.cpp:53). The encode_mm and embed_mm hooks
are implemented and tested in isolation (T03B-T03D); the false flag
was the only gate blocking the runner from dispatching multimodal
inputs through the implemented path.

kGemma4Factory copies kGemma4MmHooks as its base, so the flip
propagates to the factory the registry uses. SupportsMmInputs now
returns true for models constructed through the production factory.

Update four CHECK_FALSE(SupportsMmInputs(model)) sentinels to CHECK
in the loader and vision execution tests. These were guards for the
gate being closed; the model now advertises multimodal support. The
readiness contract test block (default factory with missing hooks)
stays unchanged.

Add a test case that constructs a model through kGemma4MmHooks and
asserts all three SupportsMmInputs preconditions: mm_inputs_ready,
encode_mm, and embed_mm.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Mark T09 (wire mm_inputs_ready to runner) as accepted. Commit
3f3500877 flips mm_inputs_ready from false to true in kGemma4MmHooks,
which propagates to kGemma4Factory (the production factory the
registry uses). SupportsMmInputs now returns true for Gemma4 models,
unlocking the runner's multimodal dispatch path.

Independent review 9cbd01cb PASS: 48/7214 loader, 5/1172 vision,
28 manifest, 3/3 mutants caught (flag revert, encode_mm null,
embed_mm null).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Add the T10A prospective spec section and issue for registering a
Gemma4 multimodal chat seam. T09 flipped mm_inputs_ready to true,
so the server now treats Gemma4 as multimodal and calls
MakeSeam. Without a registration, the server installs a generic
refusing seam. A registered factory with a Gemma4-specific refusal
message is the prerequisite for all serving-level multimodal work.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Test that MultiModalChatRegistry::Find returns a registration for
Gemma4ForConditionalGeneration, and that the seam refuses
multimedia requests with a clear message. Before the registration,
Find returns null and the test fails.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Register a multimodal chat seam for
Gemma4ForConditionalGeneration via REGISTER_VLLM_MM_CHAT.
The seam factory validates the install context (tokenizer,
config) and returns a MultiModalChatSeam whose chat_fn refuses
multimodal requests with a clear message naming the architecture
and the pending modalities. Text-only requests pass through
unchanged.

This is the prerequisite registration for all serving-level
multimodal work (T10B+). Image, audio, and video processing in
the chat path remain out of scope.

Tests: 3/3 (registration exists, factory throws on incomplete
context, refusing fn passes text through and refuses multimodal
with architecture name).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Mark T10A (register mm chat seam) as accepted. Commit b2f449b
registers a Gemma4 multimodal chat seam via REGISTER_VLLM_MM_CHAT.
The seam factory validates the install context and returns a seam
whose chat_fn refuses multimodal requests with a clear message
naming the architecture. Text-only requests pass through.

Independent review 3c85635e PASS: 4/8 tests, 2/3 mutants caught.
Mutation 3 (null chat_fn in factory) identified a coverage gap —
the refusing-fn test built chat_fn directly and never went through
the factory. Fixed with a new test that calls MakeSeam with a valid
context and asserts seam.chat_fn is non-null.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Add the T10B prospective spec section and issue for processing
image content parts through the full serving path. T10A registered
the seam but the chat_fn refuses all multimodal requests. T10B
upgrades the seam to decode images, run the image processor,
expand placeholders, and build MultiModalInputs.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Test that the seam processes an image through the full path:
chat message → rendered prompt → tokenized → image decoded →
image processed → placeholders expanded → MultiModalInputs.
Before the implementation, the seam refuses multimodal and
the test fails.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Upgrade MakeGemma4ChatSeam to process image_url content parts
through the full serving path: decode image via codec, run
Gemma4ImageProcessor, expand placeholder tokens to
[boi] + [image_token] * N + [eoi], and build MultiModalInputs
with MultiModalFeatureSpec per image.

Audio and video content parts are refused with a clear message.
Text-only requests pass through unchanged (return nullopt).

The factory resolves boi/eoi/image_token IDs from
Gemma4SpecialTokenIds (T03B, reads config.json) and validates
prompt_fn and codec are present.

Tests: mm_chat_image 2/2 (264 assertions) — image processed and
placeholders expanded, text-only passes through. Updated mm_chat
4/4 (8 assertions) — factory now builds a real seam, audio still
refused.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Mark T10B (image processing in chat seam) as accepted. Commit
833ac90 upgrades MakeGemma4ChatSeam to process image_url parts
through the full serving path: decode via codec, run
Gemma4ImageProcessor, expand placeholders to [boi] +
[image_token]*N + [eoi], build MultiModalInputs. Audio/video
still refused. Text-only passes through.

Inverse-count guard added per review issue #2: throws if the
template emitted fewer placeholders than images.

Independent review 636be6e2 PASS: mm_chat 4/4 (8 assertions),
mm_chat_image 2/2 (264 assertions), 3/3 mutants caught (swap
boi/eoi, force num_soft_tokens=0, remove audio refusal).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
Rename T09/T10A/T10B issue files to the Crockford base32 ULID
pattern required by the pr-size classifier. Add ## Problem and
## Resolution headings required by the agent-record checker.

Also adds missing FOLLOWING_AGENTS_PROTOCOL trailer to the
T03C3/C4/C5 reconciliation commit.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
@mudler
mudler force-pushed the row/MODEL-MM-gemma4-mm-gemma4-for-conditional-generation branch 3 times, most recently from d93e2de to 9ccbb34 Compare October 20, 2026 13:02
Three issue files (T09, T10A, T10B) had free-form headings instead of
the canonical field header (ID, Title, Row, State, Kind, GitHub,
Mirror, Availability, Created, Updated, Closed) that parse_issue_text
requires. Add the header and set State to CLOSED.

The sanitize-cpu lane failed to link test_gemma4_e4b_template because
kv_cache_utils.cpp, compiled directly into the test target, emits UBSan
typeinfo references for the polymorphic KV cache spec hierarchy. The
virtual destructors are =default in the header, so no key function
exists in the TU, and the linker cannot resolve the typeinfo.

Under sanitizers, link the test against vllm::sanitize_test_shared
instead of compiling kv_cache_utils.cpp directly. The shared library
emits the typeinfo and vtable symbols. Under normal builds, keep the
direct compilation for the minimal link.

The windows-msvc-cpu lane failed because gemma4_vision.cpp declares
loop variables (i, h) that shadow outer-scope variables with the same
name. MSVC /WX turns the C4456 warning into an error. Rename the
outer variables to hid and imid.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
@mudler
mudler force-pushed the row/MODEL-MM-gemma4-mm-gemma4-for-conditional-generation branch from 9ccbb34 to ddce205 Compare October 20, 2026 13:31
prof::Scope prof(...) declarations shadow the prof namespace and each
other in nested scopes. MSVC /WX turns the C4456 warning into a
build-breaking error. Rename all 19 local variables from prof to
prof_scope.

This is a pre-existing issue on main that blocks the Windows CI lanes.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]
@mudler
mudler force-pushed the row/MODEL-MM-gemma4-mm-gemma4-for-conditional-generation branch from 1874f8c to d8c45ac Compare October 20, 2026 20:42
test_gemma4_e4b_reasoning_end compiles tool parser and reasoning
parser sources directly. Under UBSan, the __ubsan_data sections
reference typeinfo for every parser subclass, but the key functions
(virtual destructors) live in TUs not compiled into this target.
The linker reports undefined reference to typeinfo for all parser
subclasses.

Link vllm::sanitize_test_shared under sanitizers to provide the
missing typeinfo and vtable symbols.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: OpenAI:ChatGPT [API]

This branch has not been deployed

No deployments
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.

2 participants