Skip to content

Commit e591ecf

Browse files
justinchubyCopilot
andauthored
Add ORT GenAI end-to-end CI (#618)
## Summary - add a network-free CPU E2E matrix against pinned `onnxruntime-genai` 0.14.1 and 0.15.2 releases - exercise tokenizer loading, generic decoder model creation, prefill, cache-dependent multi-step decode, deterministic output, reload, and malformed-config rejection - add a scheduled/manual real SmolLM-135M F16 CPU lane using immutable GGUF/tokenizer revisions, verified sizes/hashes, isolated HF/Xet caches, and the production `--runtime ort-genai` package path - enroll runtime routes through schema-validated YAML evidence and expand affected-model selection across graph, task, tokenizer, qtype, runtime helper, workflow, and dependency surfaces - document tiering, exact commands, CPU scope, released capability differences, and the CUDA waiver ## Local validation - OGA 0.14.1 fast lane: 2 passed - OGA 0.15.2 fast lane: 2 passed - OGA 0.15.2 pinned SmolLM F16 real lane: 1 passed - schema/evidence/affected detection: 340 passed - broad non-integration suite: 7,106 passed, 52 skipped, 1 subtest passed - `lintrunner f --output oneline --all-files && lintrunner -a`: clean - two independent security/reliability reviews plus a final post-fix review completed; all actionable findings resolved ## Runtime scope Required CI is CPU-only. CUDA remains scheduled/manual-only because the existing GPU infrastructure uses a CUDA-12-specific prerelease ORT feed and does not provide a stable pinned released OGA lane; this PR makes no CUDA EP claim. ## Stack Based exactly on `justinchuby-generic-genai-configs` / #611. --------- Signed-off-by: Justin Chu <[email protected]> Co-authored-by: Copilot App <[email protected]>
1 parent 063eb8c commit e591ecf

18 files changed

Lines changed: 781 additions & 83 deletions

‎.agents/skills/quality-checklist/SKILL.md‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,13 @@ python examples/<model>_text_generation.py --compare-hf --dtype bf16
165165

166166
Downstream evidence:
167167

168-
- [ ] If ORT GenAI load/generation is run, record the exact runtime version and
169-
result. Failures document limitations but never gate Mobius export based
170-
on the runtime registry, topology support, or cache executor capability.
168+
- [ ] The network-free generic decoder test passes with the pinned latest stable
169+
`onnxruntime-genai==0.15.2`.
170+
- [ ] Every runtime-supported real route has an `ort_genai` YAML marker with an
171+
immutable evidence ID, exact tokenizer provenance, bounded download size,
172+
CPU provider claim, and explicit released-version capabilities.
173+
- [ ] Real generation asserts the full generated length before token equality
174+
and runs with an isolated Hub/Xet cache that is deleted after the test.
171175
- [ ] If ORT GenAI validation is run for a model with dual head dimensions,
172176
determine whether that runtime requires
173177
`search.past_present_share_buffer=false` for its uniform KV-cache
@@ -183,7 +187,9 @@ Waiver needed if any of the steps are not possible.
183187
Run the ORT GenAI integration test:
184188

185189
```bash
186-
python -m pytest tests/ort_genai_test.py -m integration_slow -k "<model>" -sv
190+
python -m pytest tests/ort_genai_e2e_test.py -m ort_genai_fast -v
191+
python -m pytest tests/gguf_small_model_runtime_integration_test.py \
192+
-m ort_genai_real -v
187193
```
188194

189195
### 10. Foundry Local package check

‎.github/workflows/main.yml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,17 @@ jobs:
218218
HF_TOKEN: ${{ secrets.HF_TOKEN }}
219219
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
220220

221+
ort-genai-e2e:
222+
name: ORT GenAI E2E
223+
needs: [detect-affected]
224+
if: >-
225+
always() && !cancelled() &&
226+
(needs.detect-affected.result == 'failure' ||
227+
needs.detect-affected.outputs.has_affected == 'true')
228+
uses: ./.github/workflows/ort_genai_e2e.yml
229+
with:
230+
run_real: false
231+
221232
test:
222233
name: test
223234
strategy:
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: ORT GenAI End-to-End
2+
3+
on:
4+
schedule:
5+
- cron: "0 7 * * 2"
6+
workflow_dispatch:
7+
workflow_call:
8+
inputs:
9+
run_real:
10+
description: Run the pinned real-artifact lane.
11+
required: false
12+
type: boolean
13+
default: false
14+
15+
permissions:
16+
contents: read
17+
18+
concurrency:
19+
group: ort-genai-e2e-${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
fast:
24+
name: Fast CPU / OGA 0.15.2
25+
runs-on: ubuntu-latest
26+
timeout-minutes: 15
27+
steps:
28+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
29+
with:
30+
persist-credentials: false
31+
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
32+
with:
33+
python-version: "3.12"
34+
cache: pip
35+
cache-dependency-path: pyproject.toml
36+
- name: Install pinned runtime and test dependencies
37+
run: |
38+
python -m pip install --disable-pip-version-check \
39+
"onnxruntime-genai==0.15.2" \
40+
"pytest==8.4.2" \
41+
"pytest-timeout==2.4.0"
42+
python -m pip install --disable-pip-version-check -e .
43+
- name: Run network-free ORT GenAI E2E
44+
env:
45+
HF_HUB_OFFLINE: "1"
46+
TRANSFORMERS_OFFLINE: "1"
47+
MOBIUS_EXPECTED_ORT_GENAI_VERSION: "0.15.2"
48+
run: |
49+
python -m pytest tests/ort_genai_e2e_test.py \
50+
-m ort_genai_fast -v --timeout=120 --junitxml=junit-ort-genai-fast.xml
51+
- name: Upload fast-lane logs
52+
if: always()
53+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
54+
with:
55+
name: ort-genai-fast-0.15.2
56+
path: junit-ort-genai-fast.xml
57+
retention-days: 14
58+
59+
real-smollm:
60+
name: Pinned SmolLM F16 CPU / OGA 0.15.2
61+
if: inputs.run_real || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
62+
runs-on: ubuntu-latest
63+
timeout-minutes: 35
64+
steps:
65+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
66+
with:
67+
persist-credentials: false
68+
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
69+
with:
70+
python-version: "3.12"
71+
cache: pip
72+
cache-dependency-path: pyproject.toml
73+
- name: Install pinned runtime and test dependencies
74+
run: |
75+
python -m pip install --disable-pip-version-check \
76+
"onnxruntime-genai==0.15.2" \
77+
"pytest==8.4.2" \
78+
"pytest-timeout==2.4.0" \
79+
"gguf==0.17.1"
80+
python -m pip install --disable-pip-version-check -e ".[transformers]"
81+
- name: Run pinned real-artifact generation
82+
env:
83+
MOBIUS_EXPECTED_ORT_GENAI_VERSION: "0.15.2"
84+
run: |
85+
python -m pytest tests/gguf_small_model_runtime_integration_test.py \
86+
-m ort_genai_real -v --timeout=1500 --junitxml=junit-ort-genai-real.xml
87+
- name: Upload real-lane logs
88+
if: always()
89+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
90+
with:
91+
name: ort-genai-real-smollm-0.15.2
92+
path: junit-ort-genai-real.xml
93+
retention-days: 30

‎CONTRIBUTING.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,11 @@ the PR description). The full checklist with explanations lives in the
201201

202202
**Runtime and deployment**
203203
- [ ] CLI build: `mobius build --model <hf-model-id> /tmp/out` succeeds
204-
- [ ] ORT GenAI: model loads and generates coherent output; test in `tests/ort_genai_test.py`
204+
- [ ] ORT GenAI fast lane passes on the pinned latest stable runtime:
205+
`pytest tests/ort_genai_e2e_test.py -m ort_genai_fast -v`
206+
- [ ] Runtime-supported real routes declare `ort_genai` evidence in their
207+
`testdata/cases/` YAML and pass:
208+
`pytest tests/gguf_small_model_runtime_integration_test.py -m ort_genai_real -v`
205209
- [ ] Foundry Local: exported package loads and responds to a short prompt
206210
- [ ] Olive quantization: INT4/INT8 quantization runs to completion; quantized model produces coherent output
207211

‎docs/api/build_from_gguf.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ before graph construction or durable output.
421421
| `lfm2moe` | — | model=`lfm2_moe`; tensor=`lfm2`+`lfm2_moe_extras` | not claimed | config=supported; tensor_map=supported; graph=supported; runtime=deferred; quantized_import=rejected | Config extraction, exact pinned tensor-name closure, GGUF value transforms, and synthetic recurrent-state execution are covered, but no representative real-weight GGUF has yet passed independent full-logit parity and deterministic multi-token stateful ORT generation. Runtime packaging remains deferred until that evidence exists. The mobius graph uses floating Linear modules for this architecture, so no MatMulNBits or BlockQuantizedMatMul target can consume preserved GGUF projection weights. Use keep_quantized=False for explicit float import. |
422422
| `llada` | — | model=`llada`; tensor=`llama` | not claimed | config=supported; tensor_map=supported; graph=supported; runtime=deferred; quantized_import=supported | Config extraction, suffix-exact tensor closure, masked-diffusion task dispatch, and synthetic full-sequence execution are covered, but no pinned real GGUF has passed independent Hugging Face/llama.cpp masked-step logit parity and deterministic multi-step generation parity. Runtime packaging remains deferred until both exist. |
423423
| `llada-moe` | — | model=`llada`; module=`llada_moe`; tensor=`llama`+`diffusion_fused_qkv`+`moe_qk_norm_extras`+`moe_extras` | not claimed | config=supported; tensor_map=supported; graph=supported; runtime=deferred; quantized_import=supported | Config extraction, suffix-exact tensor closure, masked-diffusion task dispatch, and synthetic full-sequence execution are covered, but no pinned real GGUF has passed independent Hugging Face/llama.cpp masked-step logit parity and deterministic multi-step generation parity. Runtime packaging remains deferred until both exist. |
424-
| `llama` | `mistral` | model=`llama`; tensor=`llama` | not claimed | config=supported; tensor_map=supported; graph=supported; runtime=supported; quantized_import=supported | Runtime support is restricted to exact structured evidence matches. Currently that is only neopolita/smollm-135m-gguf F16 at the pinned artifact, CPU import route, ONNX Runtime 1.29.0, and HuggingFaceTB/SmolLM-135M tokenizer revision. |
424+
| `llama` | `mistral` | model=`llama`; tensor=`llama` | not claimed | config=supported; tensor_map=supported; graph=supported; runtime=supported; quantized_import=supported | Runtime support is restricted to exact structured evidence matches. Currently that is only neopolita/smollm-135m-gguf F16 at the pinned artifact, CPU import route, evidenced ONNX Runtime/ORT GenAI versions, and the pinned HuggingFaceTB/SmolLM-135M tokenizer revision. |
425425
| `llama-embed` | — | none (fails before config extraction) | audited-direct-loader-conditional-union | config=deferred; tensor_map=deferred; graph=deferred; runtime=deferred; quantized_import=supported | llama-embed is a canonical embedding architecture that inherits Llama's conditional tensor loader but exposes the embedding graph rather than causal logits. Mobius has no GGUF embedding task/package contract for this ID, so it must not alias ordinary llama. |
426426
| `llama4` | — | none (fails before config extraction) | exact-direct-loader-conditional-union | config=deferred; tensor_map=deferred; graph=deferred; runtime=deferred; quantized_import=supported | Llama4 GGUF is the text member of a paired multimodal package and may contain routed experts and architecture-specific cross-modal layer scheduling. The llama4 clip vision tower, token mixing, position IDs, and package ABI remain deferred; text-backbone similarity is not evidence that the complete GGUF tensor closure is owned. |
427427
| `maincoder` | — | none (fails before config extraction) | audited-direct-loader-conditional-union | config=deferred; tensor_map=deferred; graph=deferred; runtime=deferred; quantized_import=supported | Maincoder applies Q/K RMSNorm after RoPE and uses an exact tied-output QK-normalized SwiGLU closure. Existing generic QK-normalized graphs use different ordering, so a family alias would change attention. |

‎docs/design/multi-tier-testing-strategy.md‎

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -862,12 +862,34 @@ The test must verify:
862862
3. Image preprocessing config (resize, normalize, crop) matches HF
863863
4. Tokenizer and processor files are present and well-formed
864864

865-
### Proposed test tiers for ORT GenAI
865+
### ORT GenAI runtime tiers
866866

867-
| Level | What it tests | Cost | CI cadence |
868-
|-------|--------------------------------------|----------|---------------|
869-
| L1+ | Config generation (no weights) | Seconds | Every PR |
870-
| E2E | Full pipeline: export + load + gen | Minutes | Weekly / GPU |
867+
| Lane | What it tests | Runtime | CI cadence |
868+
|------|---------------|---------|------------|
869+
| Fast | Generated generic `decoder` package, tokenizer load, model creation, prefill, four cache-threaded decode steps, deterministic tokens, save/reload, and malformed config rejection | CPU; latest stable `onnxruntime-genai==0.15.2` | Relevant PRs, main, scheduled/manual |
870+
| Real | YAML-enrolled immutable artifacts with exact tokenizer provenance, byte budget, deterministic full-length generation, and disposable per-test Hub/Xet caches | CPU; currently `onnxruntime-genai==0.15.2` | Weekly and manual |
871+
872+
Run the lanes locally:
873+
874+
```bash
875+
python -m pytest tests/ort_genai_e2e_test.py -m ort_genai_fast -v
876+
python -m pytest tests/gguf_small_model_runtime_integration_test.py \
877+
-m ort_genai_real -v
878+
```
879+
880+
The `ort_genai` object in each golden-case YAML is the enrollment record.
881+
Schema and coverage tests fail when a runtime-supported GGUF route lacks a
882+
matching evidence ID. Released lanes use the architecture-neutral
883+
`model.type=decoder`; main-only `state_groups` metadata is explicitly excluded.
884+
Changes to graph construction, task wiring, ORT GenAI config generation,
885+
tokenizer packaging, and GGUF qtype/runtime helpers conservatively select the
886+
fast E2E lane through `detect_affected_models.py`.
887+
888+
CUDA is not a required PR claim. The existing self-hosted GPU lane uses a
889+
CUDA-12-specific pre-release ORT feed, so adding it to this stable-wheel
890+
lane would conflate runtime and EP coverage. CUDA runtime E2E remains suitable
891+
for scheduled/manual validation once that runner can install an equivalently
892+
pinned released stack.
871893

872894
---
873895

‎pyproject.toml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ markers = [
7878
"arch_validation: L2 architecture validation tests that download real HF configs (no weights) and build full-size ONNX graphs (deselect with '-m \"not arch_validation\"')",
7979
"golden: L4 checkpoint-verified golden comparison tests (deselect with '-m \"not golden\"')",
8080
"generation: L5 generation end-to-end golden tests (deselect with '-m \"not generation\"')",
81+
"ort_genai_fast: network-free end-to-end tests against released onnxruntime-genai wheels",
82+
"ort_genai_real: pinned real-artifact onnxruntime-genai generation tests",
8183
]
8284

8385
[tool.mypy]

‎scripts/detect_affected_models.py‎

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,33 @@
3535
_SRC_ROOT = _PROJECT_ROOT / "src" / "mobius"
3636

3737
# ----------------------------------------------------------------
38-
# Shared infrastructure paths — any change triggers run_all.
39-
# Currently empty: core infra files (e.g. _configs.py, _registry.py)
40-
# are NOT under _TRACEABLE_PREFIXES and therefore classify as "other",
41-
# triggering no model tests. Add entries here to re-enable run_all for
42-
# specific paths when broader regression coverage is needed.
38+
# Shared graph/runtime infrastructure paths — any change triggers run_all.
39+
# This is intentionally limited to surfaces that can alter exported model
40+
# graphs, runtime metadata, tokenizer assets, or GGUF qtype handling.
4341
# ----------------------------------------------------------------
44-
_SHARED_INFRA_PATTERNS: tuple[str, ...] = ()
42+
_SHARED_INFRA_PATTERNS: tuple[str, ...] = (
43+
"src/mobius/integrations/gguf/_runtime_evidence.py",
44+
"src/mobius/integrations/gguf/_runtime_package.py",
45+
"src/mobius/integrations/gguf/_tokenizer.py",
46+
"src/mobius/integrations/gguf/_builder.py",
47+
"src/mobius/integrations/gguf/_quant_registry.py",
48+
"src/mobius/integrations/gguf/_repacker.py",
49+
"src/mobius/integrations/gguf/_reader.py",
50+
"src/mobius/_builder.py",
51+
"src/mobius/_model_package.py",
52+
"src/mobius/_optimizations.py",
53+
"src/mobius/_weight_loading.py",
54+
"tests/ort_genai_e2e_test.py",
55+
"tests/gguf_small_model_runtime_integration_test.py",
56+
"testdata/cases/schema.json",
57+
".github/workflows/ort_genai_e2e.yml",
58+
"pyproject.toml",
59+
)
4560

46-
_SHARED_INFRA_PREFIXES: tuple[str, ...] = ()
61+
_SHARED_INFRA_PREFIXES: tuple[str, ...] = (
62+
"src/mobius/integrations/ort_genai/",
63+
"src/mobius/tasks/",
64+
)
4765

4866
# Traceable infrastructure: component files that are analyzed via the
4967
# import graph to find which models they actually affect, rather than
@@ -62,6 +80,11 @@ def classify_file(path: str) -> str:
6280
"""
6381
normalized = path.replace("\\", "/")
6482

83+
if normalized in _SHARED_INFRA_PATTERNS:
84+
return "shared_infra"
85+
if any(normalized.startswith(prefix) for prefix in _SHARED_INFRA_PREFIXES):
86+
return "shared_infra"
87+
6588
if not normalized.startswith("src/mobius/"):
6689
# Test infrastructure files that affect all models
6790
if normalized == "tests/conftest.py":

‎scripts/detect_affected_models_test.py‎

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_component_file(self):
4949
assert classify_file("src/mobius/components/_attention.py") == "traceable"
5050

5151
def test_task_file(self):
52-
assert classify_file("src/mobius/tasks/_causal_lm.py") == "traceable"
52+
assert classify_file("src/mobius/tasks/_causal_lm.py") == "shared_infra"
5353

5454
def test_configs_file(self):
5555
assert classify_file("src/mobius/_configs.py") == "other"
@@ -58,7 +58,7 @@ def test_registry_file(self):
5858
assert classify_file("src/mobius/_registry.py") == "other"
5959

6060
def test_builder_file(self):
61-
assert classify_file("src/mobius/_builder.py") == "other"
61+
assert classify_file("src/mobius/_builder.py") == "shared_infra"
6262

6363
def test_exporter_file(self):
6464
assert classify_file("src/mobius/_exporter.py") == "other"
@@ -85,7 +85,15 @@ def test_readme(self):
8585
assert classify_file("README.md") == "other"
8686

8787
def test_pyproject(self):
88-
assert classify_file("pyproject.toml") == "other"
88+
assert classify_file("pyproject.toml") == "shared_infra"
89+
90+
def test_ort_genai_integration_file(self):
91+
assert (
92+
classify_file("src/mobius/integrations/ort_genai/ep_config.py") == "shared_infra"
93+
)
94+
95+
def test_ort_genai_workflow(self):
96+
assert classify_file(".github/workflows/ort_genai_e2e.yml") == "shared_infra"
8997

9098
def test_windows_paths(self):
9199
assert classify_file("src\\mobius\\models\\falcon.py") == "model"
@@ -224,16 +232,19 @@ def test_component_change_traces_affected_models(self):
224232
# _attention.py is imported by many models — should find affected types
225233
assert len(result["affected"]) > 0
226234

227-
def test_task_change_does_not_trigger_run_all(self):
228-
"""Task files are traceable but produce an empty affected set.
229-
230-
No model imports ``mobius.tasks`` directly (tasks are looked up at
231-
runtime by string keys), so tracing through the import graph finds
232-
no dependents. Documented limitation — see PR description.
233-
"""
235+
def test_task_change_triggers_runtime_matrix(self):
234236
result = detect_affected_models(["src/mobius/tasks/_causal_lm.py"])
235-
assert result["run_all"] is False
236-
assert result["affected"] == []
237+
assert result == {"affected": [], "run_all": True}
238+
239+
def test_ort_genai_change_triggers_runtime_matrix(self):
240+
result = detect_affected_models(
241+
["src/mobius/integrations/ort_genai/_execution_providers.py"]
242+
)
243+
assert result == {"affected": [], "run_all": True}
244+
245+
def test_dependency_change_triggers_runtime_matrix(self):
246+
result = detect_affected_models(["pyproject.toml"])
247+
assert result == {"affected": [], "run_all": True}
237248

238249
def test_configs_change_no_run_all(self):
239250
"""_configs.py no longer triggers run_all (shared_infra disabled)."""
@@ -253,7 +264,7 @@ def test_test_configs_with_model_uses_model_scope(self):
253264
]
254265
)
255266
assert result["run_all"] is False
256-
assert result["affected"] == ["lfm2"]
267+
assert result["affected"] == ["lfm2", "lfm2_moe", "lfm2_vl"]
257268

258269
def test_test_configs_with_unmapped_task_still_runs_all(self):
259270
result = detect_affected_models(
@@ -348,18 +359,23 @@ def test_component_common_affects_many_models(self):
348359
# _common.py defines Linear, Embedding, LayerNorm — used everywhere
349360
assert len(result["affected"]) > 10
350361

351-
def test_former_shared_infra_no_run_all(self):
352-
"""Former shared_infra files no longer trigger run_all."""
362+
def test_runtime_shared_infra_runs_all(self):
353363
for path in [
354-
"src/mobius/_configs.py",
355-
"src/mobius/_registry.py",
364+
"src/mobius/_model_package.py",
365+
"src/mobius/integrations/ort_genai/auto_export.py",
366+
"src/mobius/integrations/ort_genai/genai_config.py",
367+
"src/mobius/integrations/gguf/_runtime_package.py",
368+
"src/mobius/integrations/gguf/_tokenizer.py",
369+
"src/mobius/integrations/gguf/_builder.py",
370+
"src/mobius/integrations/gguf/_quant_registry.py",
371+
"src/mobius/integrations/gguf/_repacker.py",
356372
"src/mobius/_builder.py",
373+
"src/mobius/_optimizations.py",
357374
"src/mobius/_weight_loading.py",
358-
"src/mobius/_model_package.py",
359-
"src/mobius/models/__init__.py",
375+
"testdata/cases/schema.json",
360376
]:
361377
result = detect_affected_models([path])
362-
assert result["run_all"] is False, f"{path} should NOT trigger run_all"
378+
assert result["run_all"] is True, f"{path} should trigger run_all"
363379

364380
def test_traceable_and_model_combined(self):
365381
"""A component + model file change returns union of affected types."""

0 commit comments

Comments
 (0)