Skip to content

CI: Run model detection on all events and disable shared_infra run_all - #192

Merged
tadani3 merged 10 commits into
mainfrom
tommasoadani/detection_fixes
May 8, 2026
Merged

tadani3 merged 10 commits into
mainfrom
tommasoadani/detection_fixes

Conversation

@tadani3

@tadani3 tadani3 commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Motivation

Two problems with the current CI setup:

  1. Model detection was skipped on pushes to main. The detect-affected job had if: github.event_name == 'pull_request', so pushes to main bypassed detection entirely. Downstream jobs compensated with github.event_name != 'pull_request' fallbacks that ran everything unconditionally on main — wasting compute.

  2. Any touch to base infrastructure files triggered run_all. Files like _configs.py, _registry.py, _builder.py, etc. were in _SHARED_INFRA_PATTERNS, causing every model's tests to run even for trivial or scoped changes. This made CI prohibitively slow for infrastructure work.

Changes

main.yml

  • Removed if: github.event_name == 'pull_request' from the detect-affected job — it now runs on PRs, pushes to main, and workflow_dispatch.
  • Added branch-aware diff logic: PRs diff against origin/$BASE_REF; pushes diff HEAD~1...HEAD.
  • Removed github.event_name != 'pull_request' fallbacks from synthetic-parity, golden-comparison, and generation-e2e. These jobs now rely purely on detection output (has_affected / run_all).

detect_affected_models.py

  • Commented out all entries in _SHARED_INFRA_PATTERNS. Changes to _configs.py, _registry.py, _builder.py, _weight_loading.py, _model_package.py, _exporter.py, and models/__init__.py no longer trigger run_all.
  • These files now classify as "other" and do not trigger any model tests.

detect_affected_models_test.py

  • Updated tests to match the new classification and detection behavior.

What this means in practice

Scenario Before After
Push to main Detection skipped, all tests run unconditionally Detection runs, only affected models tested
Change _configs.py run_all=true, every model tested No model tests triggered
Change _attention.py Traced via import graph (per-model) Same — no change
Change models/falcon.py Falcon + dependents tested Same — no change

How to restore run_all for infrastructure files

Re-add entries to _SHARED_INFRA_PATTERNS in scripts/detect_affected_models.py:

_SHARED_INFRA_PATTERNS: tuple[str, ...] = (
    "src/mobius/_configs.py",
    "src/mobius/_registry.py",
    # ...
)

Risk

Changes to base files like _configs.py that break multiple models will not be caught until those models are independently modified. This is an accepted tradeoff for faster CI iteration on infrastructure. If a broad regression is suspected, use workflow_dispatch with a manual change list or re-enable the patterns.

Tommaso Adani and others added 2 commits April 22, 2026 23:05
@tadani3 tadani3 self-assigned this Apr 22, 2026
@tadani3
tadani3 requested review from a team and Copilot April 22, 2026 23:19
@github-actions

github-actions Bot commented Apr 22, 2026 •

Copy link
Copy Markdown

Performance Comparison

Comparing 4f7524b → 8f588f6

Model Metric Baseline Current Delta
bert (feature-extraction) model_size_bytes 359 KB 359 KB +0.0% ⚪
bert (feature-extraction) num_nodes 60 60 +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 107 107 +0.0% ⚪
gpt2 model_size_bytes 388 KB 388 KB +0.0% ⚪
gpt2 num_nodes 53 53 +0.0% ⚪
llama model_size_bytes 425 KB 425 KB +0.0% ⚪
llama num_nodes 61 61 +0.0% ⚪
llama (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
llama (static-cache) num_nodes 58 58 +0.0% ⚪
mamba (ssm-text-generation) model_size_bytes 296 KB 296 KB +0.0% ⚪
mamba (ssm-text-generation) num_nodes 98 98 +0.0% ⚪
phi3 model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 num_nodes 59 59 +0.0% ⚪
phi3 (static-cache) model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 (static-cache) num_nodes 56 56 +0.0% ⚪
qwen2 model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 num_nodes 61 61 +0.0% ⚪
qwen2 (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 (static-cache) num_nodes 58 58 +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 275 275 +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 129 129 +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 408 408 +0.0% ⚪
t5 (seq2seq) model_size_bytes 836 KB 836 KB +0.0% ⚪
t5 (seq2seq) num_nodes 166 166 +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

Updates the CI workflow to always run affected-model detection (PRs, pushes to main, and manual runs) and adjusts detection logic so shared infrastructure changes no longer force run_all, reducing unnecessary test execution.

Changes:

  • Run detect-affected on all workflow events and compute changed files differently for PR vs non-PR events.
  • Remove non-PR fallbacks that previously caused downstream GPU/parity jobs to run unconditionally.
  • Disable _SHARED_INFRA_PATTERNS so core infra file changes no longer automatically trigger run_all.

Reviewed changes

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

File Description
.github/workflows/main.yml Runs detect-affected for more event types and gates parity/golden/e2e purely on detection outputs.
scripts/detect_affected_models.py Disables shared-infra patterns so infra changes don’t automatically force full test runs.

Comment thread .github/workflows/main.yml Resolved
Comment thread .github/workflows/main.yml Resolved
Comment thread scripts/detect_affected_models.py Resolved
@codecov

codecov Bot commented Apr 22, 2026

Copy link
Copy Markdown

The author of this PR, tadani3, is not an activated member of this organization on Codecov.
Please activate this user on Codecov to display this PR comment.
Coverage data is still being uploaded to Codecov.io for purposes of overall coverage calculations.
Please don't hesitate to email us at [email protected] with any questions.

Tommaso Adani and others added 2 commits April 22, 2026 23:24
Comment thread scripts/detect_affected_models.py Resolved
@tadani3
tadani3 enabled auto-merge (squash) April 23, 2026 18:22
@tadani3
tadani3 merged commit 28dc247 into main May 8, 2026
20 checks passed
@tadani3
tadani3 deleted the tommasoadani/detection_fixes branch May 8, 2026 00:14
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.

4 participants