Skip to content

Rename SelectiveMixedPrecision heuristic algorithms - #2643

Merged
Ti-Tai Wang (titaiwangms) merged 2 commits into
mainfrom
titaiwang/rename-smp-heuristics
Aug 28, 2026
Merged

Rename SelectiveMixedPrecision heuristic algorithms#2643
Ti-Tai Wang (titaiwangms) merged 2 commits into
mainfrom
titaiwang/rename-smp-heuristics

Conversation

@titaiwangms

@titaiwangms Ti-Tai Wang (titaiwangms) commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Describe your changes

Rename the misleading k_quant_* SelectiveMixedPrecision heuristic names to describe which layers are promoted to high precision:

  • k_quant_last -> high_precision_lm_head
  • k_quant_down -> high_precision_mlp_down
  • k_quant_mixed -> high_precision_mlp_down_qkv

Legacy configuration strings remain available and emit FutureWarning. Deprecated Python enum names remain available as silent aliases, while get_k_quant_config remains available and emits FutureWarning. The independent ORT GenAI ModelBuilder int4_algo_config values remain unchanged. Tests and quantization documentation are updated accordingly.

Checklist before requesting a review

  • Add unit tests for this change.
  • Make sure all tests can pass.
  • Update documents if necessary.
  • Lint and apply fixes to your code by running lintrunner -a
  • Is this a user-facing change? If yes, give a description of this change to be included in the release notes.

Release note: SelectiveMixedPrecision now exposes descriptive high_precision_* names for its layer-based heuristics. Existing k_quant_* configuration strings continue to work with deprecation warnings.

(Optional) Issue link

Related to #2638.

Replace misleading k_quant heuristic names with descriptive high_precision names while preserving deprecated aliases for existing configurations and callers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1d9a8b1f-9b83-4a52-bfe4-92437196e1c1

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 renames SelectiveMixedPrecision’s heuristic algorithm identifiers from the misleading k_quant_* names to descriptive high_precision_* names, while keeping legacy strings and helper APIs working via deprecation warnings. This helps reduce confusion with the separate KQuant pass and makes mixed-precision intent clearer to users.

Changes:

  • Renamed heuristic algorithms to high_precision_lm_head, high_precision_mlp, and high_precision_mlp_qkv, with legacy k_quant_* strings mapped via FutureWarning.
  • Added/updated unit tests to validate warning behavior, schema/search exposure, and algorithm validation.
  • Updated documentation and clarified that ORT GenAI ModelBuilder int4_algo_config values are unrelated and remain unchanged.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
olive/passes/pytorch/selective_mixed_precision.py Introduces new canonical heuristic names, legacy-string normalization with warnings, and renames the helper to get_high_precision_config while keeping get_k_quant_config deprecated.
test/passes/pytorch/test_selective_mixed_precision.py Updates end-to-end heuristic tests to new names and adds deprecation/normalization/schema coverage tests.
olive/passes/onnx/model_builder.py Adds a clarifying comment that int4_algo_config values are forwarded to ORT GenAI and unrelated to SelectiveMixedPrecision’s algorithm enum.
docs/source/blogs/quant-slms.md Updates the blog to reference the new high_precision_* mixed-precision configurations.

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

Comment thread olive/passes/pytorch/selective_mixed_precision.py Outdated

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

olive/passes/pytorch/selective_mixed_precision.py:663

  • Direct access to these deprecated Python names does not emit the promised FutureWarning: standard Enum alias lookup returns the canonical member directly and never invokes _missing_, which only handles value construction such as Algorithm("k_quant_down"). The new test likewise accesses Algorithm.K_QUANT_DOWN without expecting a warning. Please either add and test a warning-aware mechanism for deprecated member access or narrow the PR's compatibility/deprecation contract.
        # Deprecated Python API names. Their canonical values make these Enum aliases, so normal
        # iteration (and consequently schema/search generation) only exposes the canonical names.
        K_QUANT_LAST = "high_precision_lm_head"
        K_QUANT_DOWN = "high_precision_mlp"
        K_QUANT_MIXED = "high_precision_mlp_qkv"

Comment thread olive/passes/pytorch/selective_mixed_precision.py Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1d9a8b1f-9b83-4a52-bfe4-92437196e1c1
@titaiwangms
Ti-Tai Wang (titaiwangms) merged commit 6441a01 into main Aug 28, 2026
12 checks passed
@titaiwangms
Ti-Tai Wang (titaiwangms) deleted the titaiwang/rename-smp-heuristics branch August 28, 2026 21:23
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