Skip to content

Design per-component quantized checkpoint loading - #664

Merged
xiaoyu-work merged 3 commits into
mainfrom
docs/per-component-quantization-spec
Sep 3, 2026
Merged

xiaoyu-work merged 3 commits into
mainfrom
docs/per-component-quantization-spec

Conversation

@xiaoyu-work

Copy link
Copy Markdown
Member

Summary

  • define a canonical ComponentManifest for graph, source-path, role, and routing ownership
  • specify typed WeightRecord/WeightBundle, format-specific quantization codecs, and a narrow model adapter contract
  • define binder invariants that guarantee Mobius only loads pre-quantized values and never quantizes float weights
  • document the four-PR migration stack and test/acceptance requirements

Scope

Design documentation only; no runtime behavior changes.

@xiaoyu-work
xiaoyu-work requested review from a team and a lite review from Copilot August 27, 2026 01:30
@github-actions

github-actions Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Performance Comparison

Comparing 2605d6d → 6c38f16

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.

Pull request overview

Adds a new design proposal describing how Mobius should load pre-quantized, per-component checkpoints (potentially mixing INT4/INT8/FP across components) by introducing canonical manifests and a typed weight-loading pipeline, while explicitly keeping float→quant quantization out of Mobius.

Changes:

  • Introduces a proposed architecture centered on ComponentManifest, WeightRecord/WeightBundle, QuantizationCodec, and ModelWeightAdapter, plus binder invariants and ordering rules.
  • Documents a 4-PR migration plan and a multi-layer testing/acceptance strategy for rollout.
  • Adds the new design doc to the design docs index.

Reviewed changes

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

File Description
docs/design/per-component-quantization-loading.md New design proposal defining per-component quantized checkpoint loading abstractions, invariants, migration plan, and testing strategy.
docs/design/index.md Adds the new design doc to the Sphinx toctree.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Define the component manifest, typed weight records, codec registry, model adapter boundary, binder invariants, and staged migration plan for loading independently quantized model components.

Signed-off-by: Xiaoyu Zhang <[email protected]>
Specify authoritative per-component plans that retain regex-selected modules in floating point and define HuggingFace-to-Mobius module path translation.

Signed-off-by: Xiaoyu Zhang <[email protected]>
Name the component module field as an nn.Module attribute path and use method consistently for packed quantization provenance.

Signed-off-by: Xiaoyu Zhang <[email protected]>
@xiaoyu-work
xiaoyu-work force-pushed the docs/per-component-quantization-spec branch from 3fe1359 to 6c38f16 Compare August 27, 2026 21:30
@xiaoyu-work
xiaoyu-work merged commit 6f31718 into main Sep 3, 2026
23 of 24 checks passed
@xiaoyu-work
xiaoyu-work deleted the docs/per-component-quantization-spec branch September 3, 2026 03:01
xiaoyu-work added a commit that referenced this pull request Sep 4, 2026
## Summary

- add immutable `ComponentDescriptor` and `ComponentManifest` types
- resolve task roles, task module paths, and model
`HF_COMPONENT_SOURCES` through one canonical API
- switch `inspect_components` and build-time optimization role selection
to the manifest
- preserve the existing `ComponentSpec` and graph/weight behavior

## Stack

- Design: #664
- **This PR: component manifest foundation**
- Next: typed weight records and quantization codecs
- Then: per-component checkpoint loader
- Final: model adapter migration

## Validation

- 78 manifest/inspection/task tests
- 328 architecture and graph component tests

---------

Signed-off-by: Xiaoyu Zhang <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
titaiwangms pushed a commit that referenced this pull request Sep 17, 2026
## Summary

- Add typed weight records, component-owned bundles, and the
Olive/GPTQ/AWQ codec registry.
- Load existing quantized checkpoint weights using independent component
layouts and per-projection HuggingFace source-name overrides and
exclusions; do not quantize floating-point checkpoint weights.
- Preserve Gemma4, Qwen3.5/QMoE, and T5 architecture-specific weight
adaptations, tied tables, and component sidecar routing, and validate
quantized parameter binding.
- Preserve default attention head dimensions and KV-head counts when
HuggingFace configuration overrides only a subset of layers.
- Keep Gemma4 per-layer inputs in `[batch, sequence, layers,
projection]` form between embedding and decoder components for OpenVINO;
other execution providers retain the flattened layout.
- Restore the seq2seq, vision-language, and speech independent-component
quantization matrix coverage lost during the earlier graph-test file
split.

## Loading correctness fixes

- Recognize canonical weights only as complete, shape-matching groups so
raw GPTQ/AWQ scales remain available to their codec; validate zero
points using each projection's effective symmetry.
- Normalize quantized embedding tables for two-dimensional
GatherBlockQuantized storage rather than treating them as linear
projections.
- Honor Qwen3.5-MoE's model-declared float exclusions and Whisper's
declared output head during both graph construction and loading.
- Preserve the distinction between an absent component mapping (legacy
global rules) and an explicitly empty mapping (float components).
- Defer Gemma4 component packing until projection overrides are
resolved. Restore T5 HuggingFace source aliases and separate
decoder-stack rules from the independently owned top-level LM head.

## Consolidation

Replaces #666, #669, and #670 and consolidates the related development
from `test/per-component-quantization-stack` into this single PR.

The branch starts directly from `main` at
`a471d3416e9c52d5508d28730962e18c8a1053d0`. The design (#664) and
canonical component manifests (#665) are already merged and are not
separate dependencies of this PR.

This includes all seven previously uncommitted Gemma4/config/EP files
from the old development worktree, not just the three original PR heads.
The committed old feature stack was also compared with main plus this
PR: production feature areas were retained, and its missing graph-layout
matrix tests were restored in the current split test modules.

## Review and CI follow-up

Addressed all eight inline review threads, including
duplicate/already-resolved reports, in `190eb8a5`:

- Literal module rules now respect path boundaries; the compatibility
normalizer rejects a missing task clearly. Redundant Protocol statements
and alias parentheses are removed.
- Fixed the Gemma3 split-tied loading regression, including its
previously floating-point scaled embedding. A shared scaled quantized
embedding preserves Gemma4 behavior, and actual embedding execution plus
unsupported-tie guards are covered.
- Corrected the LLaVA fixture's missing `vision_model` namespace without
relaxing target validation.
- Updated the stale GGUF integration expectation to the export contract
already established by #688; tokenizer-identity rejection and full
logit/generation comparisons remain intact.

The original full L4/L5 jobs hit their explicit one-hour limits after
recording failures. Those failed case IDs also occur on the exact base
`a471d341`, but cancellation lost exception details, so they are not
claimed to be infrastructure-only or fixed. No model selection,
tolerance, or timeout was weakened. Isolated GPT-2 diagnostics at the
original head each executed and passed exactly one selected case: L4
https://github.com/onnxruntime/mobius/actions/runs/34308638240 and L5
https://github.com/onnxruntime/mobius/actions/runs/34308638242 . These
single-case successes do not certify the all-model golden jobs.

Fresh full CI for the published follow-up:
https://github.com/onnxruntime/mobius/actions/runs/34309655380 .

## Validation

- **874 passed, 16 skipped, 4 deselected** in the focused
loading/config/model/CLI/graph suite, including the repaired CI
selectors and scaled quantized embedding execution.
- **1 passed** for the real pinned `smollm2-135m-instruct-f16` GGUF CLI
export/reload, full-logit, and generation integration case.
- Ruff lint and formatting passed for the changed Python files.
Independent review of this follow-up found no significant issues.
- Runs used the repository-required onnx-ir API through isolated
dependencies; the shared environment was not modified.
- The original seven-file pending patch remains consolidated in this PR.
Local evidence does not claim that the all-model golden jobs or physical
NPU execution are green.

---------

Signed-off-by: Xiaoyu Zhang <[email protected]>
Signed-off-by: xiaoyu-work <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
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.

3 participants