Repository navigation
vision, refset, gpu-gates, tools: EmbeddingGemma 2 ordered decoded video frames through the Gemma4 vision tower - #374
Conversation
There was a problem hiding this comment.
Verdict: CLEAN: No must-fix findings remain after validation.
Checked
Duplicates: 13 new definitions checked; no actionable duplicate. Dryer reported 0 pairs in refset/vision; it excluded gpu-gates, whose additions were checked by Grep.
Complexity: video is new at 17. Its separable stages are reference identity/count validation and encoding/comparison; the branches reject invalid references.
Silent failure: 6 refusal paths followed through frame preparation, identities, metadata, tower and encoder errors; callers receive a named error and the gate exits FAIL.
Tests: mutation review of crates/vision/src/arch/gemma4v/media.rs:60: changing > to >= fails the 32-frame assertion; removing the empty guard fails refusal; reversing iteration at line 73 fails canvas/pixel equality; replacing 140 with 1120 at line 71 fails canvas equality. Changing either new family's kind fails each_family_takes_a_set_of_its_kind.
Gates: no bands or pins moved. The PR reports FAIL-first runs for frame order, bounds, budget, family kinds, frame identities and reference counts.
Adversarial checks: malformed RGB, excess context, reordered references and a failed reference writer are blocked by existing checks and propagated exit codes.
Performance: no engine dispatch or kernel changed; added frame work is preprocessing and gate execution.
Escape catalog: no new C1–C4 match.
Notes
GPU evidence is incomplete: the PR gives a GB10/driver description and result tables, but no nvidia-smi line or complete just gate-* command output. Attach those with the tested base/head hashes.
Local verification: changed shell syntax and Python parsing passed. Rust tests and GPU gates were not run during validation.
Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/gate_gemma_embedding2_e2e.rs and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
Part of #59 (plan and PR order in #190), item V1: video input for EmbeddingGemma 2 as an ordered list of decoded RGB frames. It builds on E7, which is on main, and has one commit.
What and why
Release notes: internal: the Gemma4 vision tower and the EmbeddingGemma 2 end-to-end gate take 1 to 32 decoded video frames in order. This is the frame interface only; HTTP video input, frame sampling and timestamps are not part of it.
EmbeddingGemma 2 embeds text and images into one vector space, and mainline llama.cpp also accepts video as a series of frames. This PR adds that case without a decoder: the caller hands over frames that are already decoded, and the tower treats each one like an E7 image.
crates/vision/src/arch/gemma4v/{media.rs,mod.rs}). One function prepares 1 to 32 frames in order. Each frame uses E7's aspect-preserving canvas with the dynamic 70 to 140 token budget. An empty list, a 33rd frame and a canvas over the budget are named errors.crates/gpu-gates/src/bin/gate_gemma_embedding2_e2e.rs). It runs the one tower on every frame and puts all spans into one encoder run. It checks frame digests, order, counts, positions, raw pooling and normalization against the video reference. Image and video vectors share the same pooled-vector comparison.crates/refset/src/arch/gemma_embedding2/{mod.rs,tests.rs,video-frames.txt}). The family owns the video set names and the six-frame sequence, and the existing family validator covers them.tools/ref/emb2/{emb2.sh,server_vectors.py,README.md},tools/ref/models/gemma-embedding2.sh). They build the ordered video request and its CPU twin with the checkpoint's default video flags, without a decoder.Memory
Video uses the existing
embedding modelnamed reserve, which staysbloomery_gpu_gemma_embedding2::card_bytes(text, ctx) + projector.card.total()bytes. One tower's activation buffers are reused for every frame, and the context figure already covers the combined run. So video adds no device bytes at the same configured limits. That is a statement about how the bytes are counted, not a measured peak. The projected BF16 rows on the host take2 * text_width * sum(frame_tokens)bytes, at most8,960 * text_widthfor 32 frames of 140 tokens.tools/ref/emb2/README.mdnow states this accounting. No new reserve or placement owner was added.Code shape
Media::prepare,SizeRule,preprocessandassemble, and its spans go throughgpu::media::check_spans. The gate's image and video paths share onepooledcomparison, and the shell's share oneimage_inputs. The ordered fixture list lives inrefset::arch::gemma_embedding2, and the shell reads it from there.unsafeblock was added.cargo fmtandcargo clippywere not run on this head. No Mac static check, comment lint or security scan ran for it either.Duplication found or removed: none beyond the inline copies of the image comparison and the image inputs, now
pooledandimage_inputs.What I ran
The branch is one commit on main
c53c26be. Each row names the head it ran on. Evidence logs are kept with the run; the working heads before the final rebase were2f7127dcandf6d574b8.c53c26be975a8c72=)python3 tools/recipes.py check2f7127dcbloomery-visionandbloomery-refsettests after restoring the mutations2f7127dcjust gate-gpu-gemma-embedding2-e2erecipef6d574b8just affectedwith--no-box, after the metadata negativesf6d574b8cargo oxide build --arch sm_121 -- -p bloomery-gpu-gates --features gemma-embedding2,vision,deepseek41 --release --bin gate_gemma_embedding2_e2e, then the whole e2e binary975a8c72The first
just affectedrun lacked--no-boxand the first metadata check called the GPU wrapper without the local card setup. Both were command errors, fixed and rerun as listed. I did not run the fullcontrib-checktier here.FAIL-first: eight edits, each caught by the check that guards it. The task's source edits were restored before the final run.
>to>=Kind::ServertoKind::Texteach_family_takes_a_set_of_its_kindfailedKind::ServerCputoKind::TextCpuvideo frame 0: expected small-200x200's bytesframes 6toframes 5in a copyvideo frame count or position count differs from referenceComparison with the reference
The reference is mainline llama.cpp
6868a52cb337450658006ad2f9281c2eb63f1666,llama-server /v1/embeddings. The model isembeddinggemma-2-Q8_0.gguf(SHA2562188ac1deca4b77dffefd603c2776a9d76d9d74ec01841392982ebb840b09135) with the BF16 projectormmproj-embeddinggemma-2-BF16.gguf(SHA256d2033b3cd0223cfb2e7a2b50dc80a664c78c816d375f5b017ec3ef80ee0bc766). The input is six decoded frames invideo-frames.txtorder, 641 assembled prompt positions, with--image-max-tokens 140 --video-fps 1 --video-timestamp-interval 0. Gates and bands are unchanged.For six ordered frames and 641 prompt positions, the relative differences to llama.cpp were 1.299214041e-2 (raw) and 1.280530432e-2 (normalized). Both were below 2.5 times the CPU twin distance. The PR makes no speed claim, so there is no timing comparison.
Part of the reference data came from E7's data root: the tokenizer, text twins, BF16 tower twins and the CUDA server set. The CPU server set and both video sets were generated fresh with
just build-emb2-refandjust dump-ref-emb2 video server.cpu video.cpuagainst a llama.cpp checkout at6868a52cb.Hardware (if the change is for a machine)
DGX Spark:
NVIDIA GB10, driver 595.84, dev container with CUDA 13 and--arch sm_121. Only this machine ran the checks. The RTX 5090 was not used because V1 changes no kernel and no device arithmetic.What I ran into
None of this blocks the PR.
just affectedtried SSH from the container, and a direct GPU wrapper call lacked the local card setup. Both were rerun correctly, as listed above.AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.