You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Support Ministral-3 / Pixtral Vision-Language Models
Adds full support for the Mistral-3 (`mistral3`) vision-language model
family, which uses the Pixtral vision encoder architecture.
### Changes
**New Components** (`src/mobius/components/_pixtral_vision.py`)
- `PixtralVisionTower` — Pixtral vision encoder with 2D RoPE,
bidirectional multi-head attention, gated MLP, and pre-normalization
- `PixtralRoPE2D` — 2D rotary position embeddings with precomputed
cos/sin cache over a spatial grid
- `Mistral3MultiModalProjector` — Spatial patch merging + MLP projection
from vision to text embedding space
- `Mistral3PatchMerger` — Merges adjacent spatial patches
(spatial_merge_size × spatial_merge_size) via reshape + linear
projection
**Model Integration** (`src/mobius/models/llava.py`)
- Added `_PixtralVisionEncoderModel` with Pixtral vision tower +
projector
- LLaVA dispatch: routes `vision_config.model_type == "pixtral"` to the
Pixtral encoder, CLIP/SigLIP for everything else
- `_preprocess_pixtral_weights` — HF→ONNX weight name remapping
(language_model.* → decoder.*, vision_tower.* → vision_encoder.*,
embed_tokens duplication)
**Config & Registry**
- `mistral3` moved from CausalLM → VLM (LLaVA-style 3-model split:
decoder, vision, embedding)
- Removed dead `mistral3` CausalLM entry
- Updated VLM test model to 3B variant
(`mistralai/Ministral-3-3B-Instruct-2512`)
- Extended `VisionConfig` with Pixtral fields (model_type, head_dim,
rope_theta)
- `_extract_vision_config` now reads both `layer_norm_eps` and
`norm_eps` for robustness
- `rope_parameters` fallback for YaRN config (used by Ministral-3)
- FP8 quantization config returns `None` (handled by dtype casting, not
block quantization)
### Tests
- Unit tests for all Pixtral components (RoPE cache, vision tower,
projector, patch merger)
- Graph build test for `mistral3` VLM (decoder + vision + embedding)
- Weight preprocessing tests for `_preprocess_pixtral_weights`
- FP8 quantization config test
- Integration tests: `ministral3` text-only (prefill ✅, decode ✅,
generation ✅) and `mistral3` VLM 3-model split
### Documentation
- CHANGELOG.md updated
- multimodal-models skill updated (Mistral3MultiModalProjector,
PixtralVisionTower)
- design.md projector table updated
### Known Limitations
- **Vision model static image dimensions**: The vision model's
`pixel_values` input has static H/W (fixed to `image_size` from config).
This is inherited from the VLM task layer (`_build_vision`) which
defines fixed input shapes for all vision models (CLIP, SigLIP,
Pixtral). Pixtral's architecture supports variable-resolution images via
2D RoPE, but the task layer currently hardcodes the dimensions. Internal
grid computations (grid_h, grid_w) ARE dynamic via Shape ops.
Variable-resolution support would require task layer changes and is
tracked as a follow-up.
### Model Coverage
| Model Type | Architecture | Status |
|-----------|-------------|--------|
| `mistral3` | VLM (LLaVAModel + Pixtral) | ✅ New |
| `ministral3` | CausalLM (text decoder) | ✅ Already supported |
| `pixtral` | VLM (LLaVAModel + Pixtral) | ✅ Now functional |
### CI
- 0 regressions on existing models (performance + architecture diff)
- All pre-existing CI failures are from main (gpt_neo, nemotron_h
synthetic parity — HF transformers compatibility)
---------
Signed-off-by: Ti-Tai Wang <titaiwang@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments