Skip to content

Qualify Olive INT2 checkpoint export - #740

Open
titaiwangms wants to merge 2 commits into
mainfrom
titaiwang/olive-int2-qualification
Open

titaiwangms wants to merge 2 commits into
mainfrom
titaiwang/olive-int2-qualification

Conversation

@titaiwangms

Copy link
Copy Markdown
Contributor

Summary

  • qualify synthetic Olive-format uniform INT2 checkpoints through the public local build() path
  • qualify mixed default INT2 with INT4 down_proj and INT8 gate_proj overrides
  • save and reload the Mobius package, then verify exact MatMulNBits attributes, input wiring, packed bytes, scales, and initializer binding
  • execute representative emitted INT2/INT4/INT8 projections explicitly on CPUExecutionProvider against an independent Olive-compatible decode

Scope

This validates the Olive checkpoint format/import/export contract and CPU operator semantics. It does not claim CUDA INT2 kernel readiness or performance, and it does not cover QMoE/fused MoE. No Mobius production changes were required after #733.

Validation

  • python -m pytest src/mobius/_component_quantization_loading_test.py -q --tb=short (61 passed)
  • python -m ruff check src/mobius/_component_quantization_loading_test.py
  • python -m ruff format --check src/mobius/_component_quantization_loading_test.py
  • git diff --check

Related: microsoft/onnxruntime#32657, microsoft/Olive#2669

Add synthetic uniform and mixed-precision Olive checkpoint coverage through Mobius build, save, reload, and CPU MatMulNBits execution. Verify exact packed layouts, graph wiring, and INT2/INT4/INT8 numerical behavior without claiming CUDA readiness.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: titaiwang <titaiwang@microsoft.com>
@titaiwangms
titaiwangms requested review from a team and a lite review from Copilot September 17, 2026 19:47
@github-actions

github-actions Bot commented Sep 17, 2026

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing 223b4384b927b3

Model Sub-model Changes Status

No architecture changes detected.


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

@github-actions

github-actions Bot commented Sep 17, 2026

Copy link
Copy Markdown

Performance Comparison

Comparing 223b4384b927b3

Model Metric Baseline Current Delta
bert (feature-extraction) model_size_bytes 359 KB 359 KB +0.0%
bert (feature-extraction) num_nodes 68 68 +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 105 105 +0.0%
gpt2 model_size_bytes 324 KB 324 KB +0.0%
gpt2 num_nodes 54 54 +0.0%
llama model_size_bytes 425 KB 425 KB +0.0%
llama num_nodes 60 60 +0.0%
llama (static-cache) model_size_bytes 425 KB 425 KB +0.0%
llama (static-cache) num_nodes 56 56 +0.0%
mamba (ssm-text-generation) model_size_bytes 296 KB 296 KB +0.0%
mamba (ssm-text-generation) num_nodes 94 94 +0.0%
phi3 model_size_bytes 421 KB 421 KB +0.0%
phi3 num_nodes 58 58 +0.0%
phi3 (static-cache) model_size_bytes 421 KB 421 KB +0.0%
phi3 (static-cache) num_nodes 54 54 +0.0%
qwen2 model_size_bytes 425 KB 425 KB +0.0%
qwen2 num_nodes 60 60 +0.0%
qwen2 (static-cache) model_size_bytes 425 KB 425 KB +0.0%
qwen2 (static-cache) num_nodes 56 56 +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 265 265 +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 127 127 +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 450 450 +0.0%
t5 (seq2seq) model_size_bytes 836 KB 836 KB +0.0%
t5 (seq2seq) num_nodes 176 176 +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.

🟡 Changes recommended

The package-level round-trip loading path is not currently exercised.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds qualification tests for synthetic Olive INT2 and mixed INT2/INT4/INT8 checkpoint export and CPU execution.

Changes:

  • Adds independent packing and decoding oracles.
  • Verifies exported MatMulNBits attributes, bindings, packed data, and scales.
  • Tests representative CPU projections.
File summaries
File Summary Finding
src/mobius/_component_quantization_loading_test.py Adds Olive checkpoint export and runtime qualification tests. Reload the saved package with ModelPackage.load(export_dir) instead of loading only model.onnx to cover package round-trip behavior. Moderate, 3 votes.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/mobius/_component_quantization_loading_test.py Outdated
Reload the saved export through ModelPackage.load so the qualification covers package discovery in addition to ONNX serialization.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: titaiwang <titaiwang@microsoft.com>

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.

🟢 Approval recommended

The focused tests validate the stated checkpoint, export, reload, and CPU execution contracts without unresolved issues.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@titaiwangms

Copy link
Copy Markdown
Contributor Author

Cross-repository real-model qualification completed locally with an Olive-produced RTN INT2 checkpoint from hf-internal-testing/tiny-random-LlamaForCausalLM, pinned at 9fb191250dd56d0ba7ec9785a025ed29c03d5998 (~1.03M parameters).

  • Mobius consumed the Olive output directory unchanged.
  • ModelPackage.save / ModelPackage.load produced 14 com.microsoft::MatMulNBits(bits=2, block_size=16) projections across both layers.
  • Every exported packed-weight initializer and scale initializer matched the source Olive safetensors exactly.
  • A representative CPU MatMulNBits projection had max absolute error 0.0 against an independent decode.
  • The complete exported ONNX model loaded and executed on CPUExecutionProvider; logits for a 3-token prompt matched Olive quantized PyTorch with max absolute error 8.940696716308594e-08.

No model artifacts were committed. This remains CPU/format qualification, not CUDA INT2 performance validation.

@titaiwangms

Copy link
Copy Markdown
Contributor Author

Real-model SMP → RTN mixed-precision qualification also completed with the same pinned tiny Llama revision.

  • Mobius consumed the Olive checkpoint unchanged and exported 14 MatMulNBits nodes: 11 INT2, 1 INT4, and 2 INT8.
  • Every packed-weight and scale initializer matched the Olive safetensors exactly.
  • Representative INT2, INT4, and INT8 CPU projections each had max absolute error 0.0 against independent decoding.
  • Full-model CPU logits matched the Olive quantized PyTorch model with max absolute error 8.940696716308594e-08.

The actual SMP heuristic selected only layer 0 down_proj for INT4 on this 2-layer model; the two INT8 gate_proj entries came from explicit RTN overrides. No artifacts were committed.

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.

2 participants