Skip to content

Add Ministral-3-3B VLM olive-recipe demo + enhance genai integration - #161

Merged
titaiwangms merged 3 commits into
mainfrom
add-ministral-3-3b-vlm-olive-recipe
Apr 30, 2026
Merged

titaiwangms merged 3 commits into
mainfrom
add-ministral-3-3b-vlm-olive-recipe

Conversation

@titaiwangms

@titaiwangms titaiwangms commented Apr 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add an end-to-end olive-recipe demo for Ministral-3-3B VLM and enhance the mobius genai integration with Pixtral processor config support and tokenizer class remapping.

Changes

Core: genai integration enhancements (src/mobius/integrations/ort_genai/)

  • _write_processor_config: Enhanced to generate full ORT-extensions image transform pipeline for VL models. Dispatches by model type (Pixtral: longest_edge resize; generic: smart_resize). Derives normalization params from HF processor config.
  • _fix_tokenizer_config: New function with _TOKENIZER_CLASS_REMAP dict to remap unsupported tokenizer classes (e.g. TokenizersBackend → LlamaTokenizer). Called automatically from write_ort_genai_config().
  • 4 new tests (31 total passing)

Example: olive-recipe demo (examples/olive/ministral-3-3b-vlm/)

  • optimize.py: Pure mobius export (build() → save() → write_ort_genai_config()) with optional Olive quantization via --olive-config
  • inference.py: ORT GenAI multimodal inference (text-only, image+text, interactive)
  • eval.py: AI2D benchmark evaluation (ONNX vs PyTorch comparison)
  • Olive configs for CPU (INT4) and CUDA (FP16) quantization
  • README with setup, export, inference, and evaluation instructions

Skills

  • New olive-recipe skill documenting the mobius + Olive hybrid pipeline pattern
  • Updated ort-genai-config skill with Pixtral processor config and tokenizer remap info

References

Closes #158

@titaiwangms
titaiwangms requested review from a team and Copilot April 10, 2026 23:04
@github-actions

github-actions Bot commented Apr 10, 2026 •

Copy link
Copy Markdown

Performance Comparison

Comparing c35d0c1 → 388f75d

Model Metric Baseline Current Delta
bert (feature-extraction) model_size_bytes 359 KB 359 KB +0.0% ⚪
bert (feature-extraction) num_nodes 60 60 +0.0% ⚪
falcon model_size_bytes 364 KB 364 KB +0.0% ⚪
falcon num_nodes 66 66 +0.0% ⚪
gemma2 model_size_bytes 428 KB 428 KB +0.0% ⚪
gemma2 num_nodes 107 107 +0.0% ⚪
gpt2 model_size_bytes 388 KB 388 KB +0.0% ⚪
gpt2 num_nodes 53 53 +0.0% ⚪
llama model_size_bytes 425 KB 425 KB +0.0% ⚪
llama num_nodes 61 61 +0.0% ⚪
llama (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
llama (static-cache) num_nodes 58 58 +0.0% ⚪
mamba (ssm-text-generation) model_size_bytes 296 KB 296 KB +0.0% ⚪
mamba (ssm-text-generation) num_nodes 98 98 +0.0% ⚪
phi3 model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 num_nodes 59 59 +0.0% ⚪
phi3 (static-cache) model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 (static-cache) num_nodes 56 56 +0.0% ⚪
qwen2 model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 num_nodes 61 61 +0.0% ⚪
qwen2 (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 (static-cache) num_nodes 58 58 +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) model_size_bytes 506 KB 506 KB +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) num_nodes 275 275 +0.0% ⚪
qwen3_5_text (hybrid-text-generation) model_size_bytes 458 KB 458 KB +0.0% ⚪
qwen3_5_text (hybrid-text-generation) num_nodes 129 129 +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) model_size_bytes 977 KB 977 KB +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) num_nodes 408 408 +0.0% ⚪
t5 (seq2seq) model_size_bytes 836 KB 836 KB +0.0% ⚪
t5 (seq2seq) num_nodes 166 166 +0.0% ⚪
whisper (speech-to-text) model_size_bytes 1008 KB 1008 KB +0.0% ⚪
whisper (speech-to-text) num_nodes 128 128 +0.0% ⚪

No performance regressions.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a complete, self-contained Olive-recipe-style end-to-end demo under examples/olive/ministral-3-3b-vlm/ for exporting and running the Ministral-3-3B vision-language model using Olive (text decoder) plus mobius (vision/embedding), with ORT GenAI inference and an AI2D eval script.

Changes:

  • Introduces an export/optimize driver (optimize.py) that runs Olive for the text decoder, mobius for vision+embedding, and then patches GenAI runtime configs/tokenizer metadata.
  • Adds runnable inference (inference.py) and AI2D benchmark evaluation (eval.py) scripts.
  • Adds CPU/CUDA Olive configs, example-specific requirements, and documentation.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
examples/olive/ministral-3-3b-vlm/user_script.py Lazy HF config loader exposing model constants used by the pipeline.
examples/olive/ministral-3-3b-vlm/requirements.txt Example dependency list for running the recipe.
examples/olive/ministral-3-3b-vlm/README.md Step-by-step instructions for export, inference, and evaluation.
examples/olive/ministral-3-3b-vlm/optimize.py End-to-end export/assembly/config generation script (Olive + mobius).
examples/olive/ministral-3-3b-vlm/inference.py ORT GenAI text+image inference CLI (including interactive mode).
examples/olive/ministral-3-3b-vlm/eval.py AI2D multiple-choice evaluation for ONNX and optional PyTorch comparison.
examples/olive/ministral-3-3b-vlm/cuda/text.json Olive ModelBuilder config for CUDA FP16 decoder export.
examples/olive/ministral-3-3b-vlm/cpu_and_mobile/text.json Olive ModelBuilder config for CPU INT4 decoder export.
examples/olive/ministral-3-3b-vlm/.gitignore Ignores generated model artifacts and Olive cache for the example.

@codecov

codecov Bot commented Apr 10, 2026

Copy link
Copy Markdown

The author of this PR, titaiwangms, is not an activated member of this organization on Codecov.
Please activate this user on Codecov to display this PR comment.
Coverage data is still being uploaded to Codecov.io for purposes of overall coverage calculations.
Please don't hesitate to email us at [email protected] with any questions.

@justinchuby justinchuby left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! A few comments

@titaiwangms

Copy link
Copy Markdown
Contributor Author

@justinchuby Can you elaborate more regarding having olive recipe e2e but mostly mobius-based? The example would be not runnable without having genai and olive-recipe though. What kind of code and docs do you have in mind in this PR scope? Like a offline example? Would it be more helpful we write it as a SKILL.md if it's for better shipping?

@titaiwangms
titaiwangms force-pushed the add-ministral-3-3b-vlm-olive-recipe branch 2 times, most recently from 9726f46 to 95309a7 Compare April 10, 2026 23:50
@justinchuby

justinchuby commented Apr 11, 2026 •

Copy link
Copy Markdown
Member

@justinchuby Can you elaborate more regarding having olive recipe e2e but mostly mobius-based? The example would be not runnable without having genai and olive-recipe though. What kind of code and docs do you have in mind in this PR scope? Like a offline example? Would it be more helpful we write it as a SKILL.md if it's for better shipping?

What I was thinking was a demonstration of a olive pipeline that leverages mobius fully + quantization with Olive, which will produce model components that can be run by genai / foundry local. This can be a demo on how we expect users to ship model. We may iterate on this until we feel good about formalizing as a skill. For now it should remain an example as a proof of concept.

@titaiwangms
titaiwangms force-pushed the add-ministral-3-3b-vlm-olive-recipe branch 3 times, most recently from dc845cf to a00bbe1 Compare April 13, 2026 18:46
@github-actions

github-actions Bot commented Apr 13, 2026 •

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing c35d0c1 → 388f75d

Model Sub-model Changes Status

No architecture changes detected. ✅


Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed)

@justinchuby justinchuby left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Hopefully it has been validated locally?

@titaiwangms titaiwangms changed the title Add Ministral-3-3B VLM olive-recipe E2E demo Add Ministral-3-3B VLM olive-recipe demo + enhance genai integration Apr 13, 2026
@titaiwangms
titaiwangms force-pushed the add-ministral-3-3b-vlm-olive-recipe branch 3 times, most recently from 528d760 to e0ec3d4 Compare April 13, 2026 20:58
@titaiwangms
titaiwangms force-pushed the add-ministral-3-3b-vlm-olive-recipe branch 8 times, most recently from 09a97e0 to 373556c Compare April 13, 2026 22:46
@titaiwangms
titaiwangms force-pushed the add-ministral-3-3b-vlm-olive-recipe branch from 373556c to 5192004 Compare April 13, 2026 22:47
@titaiwangms
titaiwangms marked this pull request as draft April 13, 2026 23:18
@titaiwangms

Copy link
Copy Markdown
Contributor Author

I will merge Ministral-3-3B to olive-recipe first.

@titaiwangms
titaiwangms marked this pull request as ready for review April 27, 2026 21:52
@titaiwangms
titaiwangms force-pushed the add-ministral-3-3b-vlm-olive-recipe branch 3 times, most recently from 60dcd76 to be90928 Compare April 27, 2026 22:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an end-to-end Olive-recipe style demo for exporting/running the Ministral-3-3B VLM under examples/olive/, and extends the ORT GenAI integration to better support VLM processor configs (including Pixtral) plus tokenizer compatibility fixes.

Changes:

  • Enhanced ORT GenAI export to write a full vision processor transform pipeline (processor_config.json) for VLMs (with Pixtral-specific steps) and added tokenizer config/chat-template fixups.
  • Added/updated unit tests covering new ORT GenAI config + processor/tokenizer behaviors.
  • Added a Ministral-3-3B VLM Olive demo directory with export, inference, evaluation scripts, and sample Olive configs.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/mobius/integrations/ort_genai/auto_export.py Adds processor pipeline generation, tokenizer class remap, and chat template fixups in ORT GenAI artifact export.
src/mobius/integrations/ort_genai/auto_export_test.py Adds tests for the new processor pipeline format, Pixtral-specific pipeline, and tokenizer/chat-template fixups.
src/mobius/integrations/ort_genai/genai_config_test.py Adds a regression test for decoder filename subdirectory handling in VLM configs.
examples/olive/ministral-3-3b-vlm/requirements.txt Documents example dependencies for export/inference/eval.
examples/olive/ministral-3-3b-vlm/optimize.py Adds an export script using mobius + optional Olive quantization for the text decoder.
examples/olive/ministral-3-3b-vlm/inference.py Adds an ORT GenAI inference script supporting text-only and image+text prompts.
examples/olive/ministral-3-3b-vlm/eval.py Adds an AI2D evaluation script comparing ONNX (ORT GenAI) vs HF PyTorch.
examples/olive/ministral-3-3b-vlm/cuda/text.json Olive config for CUDA FP16 ModelBuilder export/quantization of the text decoder.
examples/olive/ministral-3-3b-vlm/cpu_and_mobile/text.json Olive config for CPU/mobile INT4 ModelBuilder export/quantization of the text decoder.
examples/olive/ministral-3-3b-vlm/README.md Documents setup, export, output layout, inference, and evaluation for the demo.
examples/olive/ministral-3-3b-vlm/.gitignore Ignores generated artifacts for the example.
.github/copilot-instructions.md Updates contributor guidance about squashing/batching commits to reduce CI churn.

@titaiwangms
titaiwangms force-pushed the add-ministral-3-3b-vlm-olive-recipe branch 2 times, most recently from d67c8d2 to 1fdbd08 Compare April 28, 2026 19:16
Enhance _write_processor_config in ort_genai auto_export to generate
full image transform pipeline for Pixtral VL models. Add tokenizer
class remapping (TokenizersBackend -> LlamaTokenizer).

Update examples/olive/ministral-3-3b-vlm/ to leverage the enhanced
genai integration with optional Olive quantization.

Closes #158

Co-authored-by: Copilot <[email protected]>
Signed-off-by: Ti-Tai Wang <[email protected]>
@titaiwangms
titaiwangms force-pushed the add-ministral-3-3b-vlm-olive-recipe branch from 1fdbd08 to c280900 Compare April 30, 2026 00:14
Comment thread .github/copilot-instructions.md Resolved
Critical:
- Add missing Permute3D + PixtralImageSizes transforms to Pixtral
  pipeline (5 steps → 7 steps, matching olive-recipes reference)
- Fix config_filename mismatch: Pixtral with_vision() now passes
  config_filename="processor_config.json" (was using default
  "image_processor.json")

Medium:
- Extract _build_vision_transform_pipeline() shared helper to DRY
  the Pixtral and generic VLM branches (~80 duplicated lines removed)

Low:
- Add mistral3 to _ORT_GENAI_MODEL_TYPE + _PIXTRAL_MODEL_TYPES
- Update module docstring to mention processor_config.json
- Improve pixtral test: verify 7-step pipeline, all transform types
  in order, Permute3D dims, and output filename

Co-authored-by: Copilot <[email protected]>
@titaiwangms
titaiwangms force-pushed the add-ministral-3-3b-vlm-olive-recipe branch from c280900 to 0f8d8ab Compare April 30, 2026 20:37
@titaiwangms
titaiwangms enabled auto-merge (squash) April 30, 2026 20:44
@titaiwangms
titaiwangms merged commit 93f0f55 into main Apr 30, 2026
20 of 21 checks passed
@titaiwangms
titaiwangms deleted the add-ministral-3-3b-vlm-olive-recipe branch April 30, 2026 20:50
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.

Add Ministral-3-3B VLM olive-recipe E2E demo to examples/olive/

3 participants