Gemma 4 Multimodal & Advanced Features
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 20/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- kotlin
- Lĩnh vực
- ai, machine-learning
Hướng nghiên cứu
Start by inspecting the Gemma 4 runtime and Gemma4PromptFormatter, then trace how model configuration, tokenization, and inference are handled. The issue lists image and audio processors, vision and audio encoders, MoE routing, and LoRA ingestion as separate areas; choose one milestone and identify its existing entry points and tests. Done means meeting that milestone’s listed acceptance criteria with tests while keeping text-only behavior intact.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Extend the Gemma 4 text-only runtime with multimodal capabilities (image, audio, video-via-frames), MoE support for the 26B A4B variant, and adapter/fine-tuning artifact ingestion. This issue covers vision/audio encoders, multimodal prompt handling, placeholder token replacement, and the expert routing layer.
Motivation
Gemma 4 is natively multimodal (text+image on all sizes; audio on E2B/E4B). Multimodal support unlocks on-device vision and audio use cases. The 26B A4B MoE variant offers a high-capability model with efficient active parameter usage, relevant for server-side deployments.
Functional Requirements
1. Image Processing & Vision Encoder
- Implement image processor according to
processor_config.json/preprocessor_config.json - Support variable Visual Token Budget (70 / 140 / 280 / 560 / 1120 tokens)
image_seq_lengthhandling from config- Vision encoder inference (architecture per
vision_configinconfig.json) - Placeholder token replacement:
<|image|>tokens in the token stream are replaced by soft embeddings from the vision encoder output after tokenization - Multimodal content should appear before text in prompts for optimal performance
2. Audio Processing & Audio Encoder
- Audio processor for E2B and E4B models (which support audio input)
- Audio encoder inference (architecture per
audio_configinconfig.json) - Placeholder token replacement:
<|audio|>tokens replaced by audio encoder soft embeddings - Audio preprocessing pipeline (sampling rate, feature extraction)
3. Video Support (via Frames)
- Video input decomposed into image frames
- Frame extraction strategy (sampling rate, max frames)
- Each frame processed through the vision encoder pipeline
- Correct token budget allocation across frames
4. Multimodal Prompt Handling
- Extend
Gemma4PromptFormatterto handle interleaved text and media placeholders - Correct ordering: multimodal content before text in prompts
- Token-index mapping for embedding insertion (map placeholder token positions to encoder output embeddings)
- Support mixed-modality turns (image + text, audio + text)
5. MoE Dispatcher (26B A4B Variant)
- Expert routing abstraction for Mixture-of-Experts layers
- 26B A4B architecture: 128 total experts, 8 active + 1 shared expert per token
- Top-K expert selection mechanism
- Efficient expert weight loading (only active experts need to be in memory for inference)
- Config-driven: MoE parameters from
config.json(num_experts,num_active_experts,num_shared_experts)
6. Adapter / Fine-Tuning Artifact Ingestion
- Support loading LoRA adapter weights alongside base model
- Adapter weight merging or runtime application during inference
- Compatibility with externally trained adapters (TRL, HF PEFT format)
7. Multimodal Data & Fine-Tuning Pipeline (Outline)
- SFT dataset format specification for multimodal inputs:
{image/audio/video frames + text prompt + text output} - Visual Token Budget variation in training data
- Data governance: safety filtering, license checks, CSAM filtering compliance
- Multimodal annotation pipeline requirements
Acceptance Criteria
Image Support
- Image processor correctly preprocesses images according to
processor_config.json - Visual Token Budget is configurable (70/140/280/560/1120) and correctly applied
- Vision encoder produces embeddings of expected shape
-
<|image|>placeholder tokens are correctly replaced by vision encoder soft embeddings in the token stream - End-to-end image+text inference produces coherent outputs for E2B model
- Multimodal content placed before text in prompts
Audio Support
- Audio processor handles standard audio formats and sample rates
- Audio encoder produces embeddings of expected shape
-
<|audio|>placeholder tokens are correctly replaced in the token stream - End-to-end audio+text inference works for E2B and E4B models
Video Support
- Video frames are extracted and processed through the vision pipeline
- Token budget is correctly distributed across frames
- Multi-frame inference produces coherent outputs
MoE (26B A4B)
- MoE config is parsed from
config.json(expert counts, routing parameters) - Expert routing selects top-K experts per token correctly
- Shared expert is always active alongside selected experts
- 26B A4B model loads and runs inference end-to-end
- Memory usage reflects active parameters (not total parameters)
Adapter Ingestion
- LoRA adapter weights in HF PEFT format can be loaded alongside base Gemma 4 model
- Adapter application produces different outputs compared to base model (verifiable)
General
- All new features have unit and integration tests
- CI passes with extended test suite
- Text-only functionality remains unaffected by multimodal additions
- Apache-2.0 license compliance maintained for all new components
Risks & Mitigations
| Risk | Mitigation |
|---|---|
| Vision/audio encoder complexity | Start with image-only (simplest modality), validate end-to-end before adding audio |
| MoE memory requirements (26B total params) | Implement lazy expert loading; defer MoE to later milestone if memory is prohibitive on target devices |
| Placeholder token replacement correctness | Golden tests comparing embedding insertion positions against HF reference implementation |
| Multimodal data pipeline scope creep | Keep fine-tuning pipeline as outline/spec only; implementation deferred to dedicated issue |
Estimated Effort
| Component | Effort |
|---|---|
| Image Processor + Vision Encoder | High |
| Audio Processor + Audio Encoder | High |
| Video Frame Pipeline | Medium |
| Multimodal Prompt Handling | Medium |
| MoE Dispatcher | High |
| Adapter Ingestion | Medium |
| Tests & CI | Medium |
Milestones
- Image MVP — Single image + text inference for E2B (priority)
- Audio MVP — Audio + text inference for E2B/E4B
- MoE — 26B A4B loads and runs inference
- Video — Multi-frame video inference
- Adapters — LoRA weight loading and application
- Ngôn ngữ chính
- Kotlin
- Star
- 8
- Fork
- 3
- Merge trung bình
- 1 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 48
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SKaiNET-developers/SKaiNET-transformers
-
documentation good first issue size:xs skill:docs sub-issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
SKaiNET-developers/SKaiNET-transformers#478 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement skill:kotlin-core
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
SKaiNET-developers/SKaiNET-transformers#502 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
SKaiNET-developers/SKaiNET-transformers#483 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
coding good first issue size:s skill:kotlin-core sub-issue
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 64/100
SKaiNET-developers/SKaiNET-transformers#477 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
coding good first issue size:s skill:numerics sub-issue
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
SKaiNET-developers/SKaiNET-transformers#476 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của SKaiNET-developers/SKaiNET-transformers
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Droid-Deck/DroidDeck#1098 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Blank screen in Download tab after searching with no results and switching tabsCó thể đã có người làm @mangod12 đã nhận hôm nay. Đang mởbug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
kiwix/kiwix-android#5211 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
deniscerri/ytdlnis#1430 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] Lock owned by another client (e.g. Text app) cannot be unlocked from the appCó thể đã có người làm @falkloewert đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Minor documentation improvementsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100