Skip to content

Add canonical component manifests - #665

Open
xiaoyu-work wants to merge 5 commits into
mainfrom
refactor/component-manifest
Open

Add canonical component manifests#665
xiaoyu-work wants to merge 5 commits into
mainfrom
refactor/component-manifest

Conversation

@xiaoyu-work

Copy link
Copy Markdown
Contributor

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

Validation

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

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

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown

Performance Comparison

Comparing 2605d6d1f47daa

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

This PR introduces a canonical, immutable “component manifest” layer that centralizes per-component metadata (name, module path, optimization role, and HF source-path ownership). It integrates this manifest into component inspection and build-time optimization role selection while preserving existing graph/weight behavior.

Changes:

  • Added ComponentDescriptor / ComponentManifest plus resolve_component_manifest() and get_hf_component_sources() as the canonical component-metadata API.
  • Added ModelTask.component_manifest() and updated inspect_components() to source roles + HF paths through the manifest.
  • Switched build-time optimization role selection in build_from_module() to consult the manifest.

Reviewed changes

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

Show a summary per file
File Description
src/mobius/tasks/_base.py Adds ModelTask.component_manifest() as a task-level entrypoint to resolve canonical component metadata.
src/mobius/_inspect.py Routes HF component source resolution + inspect_components() output through the new manifest API.
src/mobius/_component_manifest.py Introduces immutable component descriptor/manifest types and the canonical resolution helpers.
src/mobius/_component_manifest_test.py Adds unit tests for manifest resolution, dynamic HF source resolvers, and duplicate-name validation.
src/mobius/_builder.py Uses the manifest for selecting optimization roles per package entry during build-time optimization.

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

Comment thread src/mobius/_component_manifest.py Outdated
Comment thread src/mobius/_component_manifest.py Outdated
@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing 2605d6d1f47daa

Model Sub-model Changes Status
bert (feature-extraction) model 0
falcon model 0
gemma2 model 0
gemma4 (gemma4) decoder 0
gemma4 (gemma4) embedding 0
gemma4 (gemma4) vision_encoder 0
gemma4_text model 0
gpt2 model 0
llama model 0
llama (static-cache) model 0
mamba (ssm-text-generation) model 0
phi3 model 0
phi3 (static-cache) model 0
qwen model 0
qwen (static-cache) model 0
qwen2 model 0
qwen2 (static-cache) model 0
qwen2_moe model 0
qwen2_moe (static-cache) model 0
qwen3 model 0
qwen3 (static-cache) model 0
qwen3_5_moe (hybrid-text-generation) model 0
qwen3_5_text (hybrid-text-generation) model 0
qwen3_5_vl (hybrid-qwen-vl) decoder 0
qwen3_5_vl (hybrid-qwen-vl) embedding 0
qwen3_5_vl (hybrid-qwen-vl) vision_encoder 0
qwen3_moe model 0
qwen3_moe (static-cache) model 0
qwen3_next (hybrid-text-generation) model 0
t5 (seq2seq) decoder 0
t5 (seq2seq) encoder 0
whisper (speech-to-text) decoder 0
whisper (speech-to-text) encoder 0

No architecture changes detected.


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

Comment thread src/mobius/_component_manifest_test.py Fixed
Resolve task roles, module paths, and HuggingFace source ownership into one immutable manifest. Switch inspection and optimization-role lookup to the shared metadata without changing graph or weight behavior.

Signed-off-by: Xiaoyu Zhang <xiaoyuzhang@microsoft.com>
Derive candidate HuggingFace module names from component-local paths so later loader stages can apply exact and regex quantization exclusions consistently.

Signed-off-by: Xiaoyu Zhang <xiaoyuzhang@microsoft.com>
Only derive HuggingFace module candidates when a declared source root shares an anchor with the component-local path, preventing unrelated roots such as lm_head from matching every decoder module.

Signed-off-by: Xiaoyu Zhang <xiaoyuzhang@microsoft.com>
Allow model declarations to map component-local module prefixes to HuggingFace source prefixes when structural anchor inference is insufficient.

Signed-off-by: Xiaoyu Zhang <xiaoyuzhang@microsoft.com>
Rename module_path to module_attribute_path and document task-defined optimization roles so callers cannot confuse Python module ownership with package or checkpoint prefixes.

Signed-off-by: Xiaoyu Zhang <xiaoyuzhang@microsoft.com>
@xiaoyu-work
xiaoyu-work force-pushed the refactor/component-manifest branch from 501c342 to 1f47daa Compare August 27, 2026 21:30
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