Skip to content

docs: Add EP-aware model building documentation - #117

Merged
justinchuby merged 5 commits into
mainfrom
justinchu/ep-docs
Apr 8, 2026
Merged

docs: Add EP-aware model building documentation#117
justinchuby merged 5 commits into
mainfrom
justinchu/ep-docs

Conversation

@justinchuby

Copy link
Copy Markdown
Member

Documents the EP-aware model building infrastructure added in PR #103.

Changes

New: docs/ep_quickstart.md

Practical 5-section guide for the most common EP tasks:

  1. Build for a specific EP (code + CLI examples)
  2. See what each EP does (trace mode walkthrough)
  3. Query which EPs are available (ep_registry, get_ep())
  4. Register a custom EP (register_ep())
  5. Common EP configurations at a glance (table)

Updated: docs/execution_providers.md

  • New "When to use build_context() vs optimize_model() directly" section with a summary table of all API entry points (build(), build_from_module(), optimize_model(), build_context())
  • Clarified Step 2 of "Adding a New EP": documents both the rewrite-rule approach (for post-build graph rewrites) and the generation-time ep_capabilities() approach (for component-level branching)

Updated: README.md

  • Added EP-aware optimization paragraph with CUDA/WebGPU code examples
  • Links to the new quickstart and full reference docs

Accuracy note

All content is derived directly from reading the source code. Docstrings for EpCapabilities, EpRegistry, build_context(), optimize_model(), and build() were verified and are already comprehensive — no docstring changes needed.

- Create docs/ep_quickstart.md: 5-section practical guide (build for a
  specific EP, trace mode, query ep_registry, register a custom EP,
  common EP configurations table)
- Expand docs/execution_providers.md:
  - New 'When to use build_context() vs optimize_model() directly'
    section with summary table of API entry points
  - Clarify Step 2 of 'Adding a New EP': both rewrite-rule and
    generation-time (ep_capabilities()) approaches documented
- README.md: Add EP-aware optimization paragraph with code examples
  and links to the quickstart and full reference docs

All new content is derived from reading the source code (PR #103,
now merged). No speculative or inaccurate information added.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown

Performance Comparison

Comparing fcbd88f55de6ec

Model Metric Baseline Current Delta
bert (feature-extraction) model_size_bytes 359 KB 359 KB +0.0%
bert (feature-extraction) num_nodes 49 49 +0.0%
falcon model_size_bytes 364 KB 364 KB +0.0%
falcon num_nodes 53 53 +0.0%
gemma2 model_size_bytes 428 KB 428 KB +0.0%
gemma2 num_nodes 92 92 +0.0%
gpt2 model_size_bytes 388 KB 388 KB +0.0%
gpt2 num_nodes 40 40 +0.0%
llama model_size_bytes 425 KB 425 KB +0.0%
llama num_nodes 46 46 +0.0%
llama (static-cache) model_size_bytes 425 KB 425 KB +0.0%
llama (static-cache) num_nodes 43 43 +0.0%
mamba (ssm-text-generation) model_size_bytes 360 KB 360 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 46 46 +0.0%
phi3 (static-cache) model_size_bytes 421 KB 421 KB +0.0%
phi3 (static-cache) num_nodes 43 43 +0.0%
qwen2 model_size_bytes 425 KB 425 KB +0.0%
qwen2 num_nodes 46 46 +0.0%
qwen2 (static-cache) model_size_bytes 425 KB 425 KB +0.0%
qwen2 (static-cache) num_nodes 43 43 +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 233 233 +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 113 113 +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 381 381 +0.0%
t5 (seq2seq) model_size_bytes 836 KB 836 KB +0.0%
t5 (seq2seq) num_nodes 141 141 +0.0%
whisper (speech-to-text) model_size_bytes 1008 KB 1008 KB +0.0%
whisper (speech-to-text) num_nodes 95 95 +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 adds documentation for mobius’ execution-provider (EP) aware build + optimization pipeline, including a new quickstart guide and expanded reference docs, and updates the README to point users at the EP workflow.

Changes:

  • Added a new practical guide: docs/ep_quickstart.md (common EP workflows: build, trace, query/register EPs).
  • Expanded docs/execution_providers.md with guidance on when to use build()/build_from_module() vs build_context() vs optimize_model(), and clarified EP extension approaches.
  • Updated README.md to introduce EP-aware optimization and link to the new documentation.

Reviewed changes

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

File Description
README.md Adds an EP-aware optimization intro + Python examples + doc links.
docs/execution_providers.md Adds an API decision guide and clarifies EP extension guidance.
docs/ep_quickstart.md New “under 3 minutes” guide for EP-aware building tasks and examples.

Comment thread README.md Outdated
Comment thread docs/execution_providers.md
Comment thread docs/execution_providers.md Outdated
Comment thread docs/ep_quickstart.md Outdated
Comment thread docs/ep_quickstart.md Outdated
justinchuby and others added 2 commits April 7, 2026 17:25
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Export EpCapabilities, ep_registry, register_ep, get_ep, and optimize_model
from mobius.__init__ so users don't need to import from private submodules.
Update docs/ep_quickstart.md and docs/execution_providers.md to use
public imports throughout.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing fcbd88f55de6ec

Model Sub-model Changes Status

No architecture changes detected.


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

justinchuby and others added 2 commits April 7, 2026 17:34
- Trace examples: Stage 2 shows 5 rule groups (not 4) for CUDA/f16/decoder;
  add missing PackQKV stage with correct node counts verified from real
  optimize_model() trace output (Qwen3 2-layer model, scaled to 1B/3B)
- EpCapabilities reference: add 2 missing fields (supports_fused_matmul,
  supports_packed_multi_head_attention) with correct descriptions
- default_int4_accuracy_level comment: '0 = no INT4' → '0 = highest accuracy'
  to match the actual docstring semantics (0 = most accurate, 4 = fastest)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
- README.md: use build() directly (from mobius import build) instead of mobius.build()
- execution_providers.md: add 'import onnx_ir as ir' to all code snippets using ir.DataType
- execution_providers.md: fix test file reference _common_test.py -> src/mobius/_build_context_test.py
- ep_quickstart.md: fix wording 'at optimization time' -> 'during build-time validation, before graph construction or optimization starts'
- ep_quickstart.md: fix 'No vendor-specific ops' -> 'No EP-specific vendor fusions (e.g. no GQA/PackQKV)'

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
@justinchuby
justinchuby merged commit ef89fde into main Apr 8, 2026
20 of 21 checks passed
@justinchuby
justinchuby deleted the justinchu/ep-docs branch April 8, 2026 01:27
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