Skip to content

feat(multi-modal): Phase 0 + Phase 1 — cross-architecture vision capt…#143

Merged
chrishayuk merged 2 commits into
mainfrom
feat/multi-modal-phase1
May 24, 2026
Merged

feat(multi-modal): Phase 0 + Phase 1 — cross-architecture vision capt…#143
chrishayuk merged 2 commits into
mainfrom
feat/multi-modal-phase1

Conversation

@chrishayuk

Copy link
Copy Markdown
Owner

Generic multi-modal trait surface (Phase 0) + end-to-end Gemma 3 + SigLIP prefix-only captioning (Phase 1), verified on 3 reference images.

Phase 0 — trait surface + EmbeddingPlan, no behaviour change:

  • VisionConfig / VisionWeights / ProjectorWeights (arch-agnostic)
  • ModalEncoder / Connector / MultiModalProtocol traits
  • embed_plan() alongside embed_tokens_pub, bit-identical on text-only

Phase 1 — Gemma 3 4B + SigLIP end-to-end:

  • 1a: Gemma3MultiModal protocol (verified token IDs 255999/262144/256000)
  • 1b: SigLIP vision tower CPU forward (bidirectional attention, GELU-tanh)
  • 1c: AvgPool2d(4,4) → RMSNorm → linear projector (4096,1152) → (256,2560)
  • 1d: --image/--mm-weights CLI, KvEngine seam (ADR-0023), Q4K dispatch

Engine seam (ADR-0023): supports_multimodal() + prefill_from_hidden() on KvEngine, default-false debt convention. StandardEngine is Phase 1's only MM-capable engine. generate_with_engine_from_hidden wrapper. AnyEngine forwards both methods.

3-image regression test (red/circle/unicorn) with positive+negative keyword assertions — all pass on Gemma 3 4B-it Q4K. Unicorn caption extracts secondary visual features ("colorful bubbles"), ruling out case-(b) silent failure (LM generating without conditioning on vision).

Docs: docs/multi-modal.md (design + phased plan), docs/adr/0023 (engine seam), updated README, AGENTS, root ROADMAP, 5 per-crate ROADMAPs.

…ioning

Generic multi-modal trait surface (Phase 0) + end-to-end Gemma 3 + SigLIP
prefix-only captioning (Phase 1), verified on 3 reference images.

Phase 0 — trait surface + EmbeddingPlan, no behaviour change:
  - VisionConfig / VisionWeights / ProjectorWeights (arch-agnostic)
  - ModalEncoder / Connector / MultiModalProtocol traits
  - embed_plan() alongside embed_tokens_pub, bit-identical on text-only

Phase 1 — Gemma 3 4B + SigLIP end-to-end:
  - 1a: Gemma3MultiModal protocol (verified token IDs 255999/262144/256000)
  - 1b: SigLIP vision tower CPU forward (bidirectional attention, GELU-tanh)
  - 1c: AvgPool2d(4,4) → RMSNorm → linear projector (4096,1152) → (256,2560)
  - 1d: --image/--mm-weights CLI, KvEngine seam (ADR-0023), Q4K dispatch

Engine seam (ADR-0023): supports_multimodal() + prefill_from_hidden() on
KvEngine, default-false debt convention. StandardEngine is Phase 1's only
MM-capable engine. generate_with_engine_from_hidden wrapper. AnyEngine
forwards both methods.

3-image regression test (red/circle/unicorn) with positive+negative keyword
assertions — all pass on Gemma 3 4B-it Q4K. Unicorn caption extracts
secondary visual features ("colorful bubbles"), ruling out case-(b) silent
failure (LM generating without conditioning on vision).

Docs: docs/multi-modal.md (design + phased plan), docs/adr/0023 (engine
seam), updated README, AGENTS, root ROADMAP, 5 per-crate ROADMAPs.
@chrishayuk
chrishayuk merged commit da51ac3 into main May 24, 2026
42 of 43 checks passed
@chrishayuk
chrishayuk deleted the feat/multi-modal-phase1 branch June 5, 2026 23:56
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