Skip to content

Studio: auto transformer precision walks int8 first on every GPU tier - #10888

Closed
danielhanchen wants to merge 11 commits into
mainfrom
studio-auto-int8-first
Closed

danielhanchen wants to merge 11 commits into
mainfrom
studio-auto-int8-first

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

Summary

auto transformer precision now walks int8 first on every GPU tier. Until now the ladder led with fp8 on data-center Ada, Hopper and Blackwell parts and moved int8 first only on consumer and workstation cards (_prefer_consumer_scheme, keyed on the device name). That split is gone: int8, then fp8, then mxfp8 on Blackwell; int8 then fp8 on Ada and Hopper; int8 alone on Ampere, as before. An explicit fp8 request is honored exactly as it was, nvfp4 stays an explicit opt-in, and the family deny list is unchanged.

Why int8 leads

  • Every hosted checkpoint repo ships an int8 denoiser file (unsloth/*-FP8 carries both -INT8.pt and -FP8.pt), so the default rung is the one whose artifact always exists.
  • MiniMax H3 already settles an unset precision on int8 (_h3_auto_denoiser_scheme: faster per generation and 45 GB less resident than the hosted fp8). The image path now agrees with it, and the picker's Fast INT8 suffix, which reads the first scheme of dense_quant_schemes, names the rung that actually runs.
  • On consumer and workstation cards int8 runs full rate while fp8 FP32 accumulate is halved, which is why the ladder already put it first there. On the user's own hardware (RTX 5090, DGX Spark) nothing changes.
  • On B200 the two rungs are within a few percent of each other at 1024px, graphed and compiled: z-image 0.522 s int8 against 0.539 s fp8 per render (Studio: capture the diffusion denoiser step into a CUDA graph #10537's table), qwen-image 1.10x bf16 against 1.21x. At 512px fp8 is about 10 percent faster (0.158 s against 0.175 s); the ladder trades that for one default across every host.

Accuracy from the 28-pair prequant gate on B200 (LPIPS mean against bf16, int8 / fp8; both rungs clear the gate wherever both are hosted): qwen-image 0.057 / 0.154, flux.1-schnell 0.151 / 0.157, flux1-dev 0.125 / 0.134, flux1-krea-dev 0.098 / 0.119, flux.2-dev 0.078 / 0.073, z-image 0.181 / 0.129, krea-2 0.223 / 0.172, lumina2 0.146 / 0.116, hidream 0.291 / 0.278. int8 is the better rung on the Qwen and FLUX.1 families and fp8 on Z-Image, Krea 2, Lumina 2 and HiDream; a user who wants the other rung picks it in Precision.

What changed

  • diffusion_transformer_quant.py: _AUTO_LADDER reordered, _prefer_consumer_scheme removed (its two call sites walk the tier as listed). _is_consumer_gpu stays for the fp8 fast-accumulate gate and the speed layer.
  • auto_scheme_candidates, which the loader's lower-rung retry and /api/system's dense_quant_schemes read, follows the same order, so the retry and the picker label cannot disagree with the selector.

Tests

test_diffusion_transformer_quant.py: the Blackwell, Ada, Hopper, professional and consumer cases now assert int8 first and fp8 next, the Qwen deny case asserts int8 then fp8 then nothing, and the candidates test asserts the new order. Full studio/backend/tests and studio/backend/hub/tests green.

Evidence

The Images model picker on a B200, from two isolated installs driven by one Playwright scene. Every official image row reads its speed suffix off the first entry of /api/system's dense_quant_schemes, so this PR moves the label without touching a frontend file.

These are not this PR's own merge base, and could not be: the field and the suffix that renders it are added by #10883, so against its own merge base the pair is byte identical. BEFORE is #10883's head with this ladder reverted, AFTER is #10883's head, which isolates the ladder alone. Re-shot against #10883's current head 68f6854f63, with _AUTO_LADDER reverted to fp8 first as the BEFORE side, after the latest review round; the composites below came out byte identical to the first run.

/api/system dense_quant_schemes: ["fp8", "mxfp8", "int8"] to ["int8", "fp8", "mxfp8"].

picker rows before and after

Z-Image-Turbo, Qwen-Image 2512, Qwen-Image and FLUX.1 schnell all move from (Fast FP8) to (Fast INT8). The bnb-4bit and GGUF rows are untouched, which is the control.

the Z-Image-Turbo row

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-14T09:08:49.863223Z b999df7 Manual request
🔒 Security Review ✅ Completed 2026-09-14T02:26:30.737293Z 00a0ec9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 14, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 75b3562842

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 14, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 14, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 75b3562842

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +213 to +215
((10, 0), (TQ_INT8, TQ_FP8, TQ_MXFP8)), # Blackwell sm_100+ (nvfp4 is explicit opt-in only)
# ((10, 0), (TQ_INT8, TQ_FP8, TQ_NVFP4, TQ_MXFP8)), # restore to re-enable nvfp4 under auto
((8, 9), (TQ_INT8, TQ_FP8)), # Ada sm_89 / Hopper sm_90

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Update the documented auto preference order

With this ladder, auto now chooses int8 first on Ada, Hopper, and Blackwell, but the module-level documentation still says that Blackwell prefers nvfp4/mxfp8 and that Ada, Hopper, and Blackwell prefer fp8. Anyone consulting that documentation to understand or modify the precision policy will get the opposite ordering, so update it alongside the ladder.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b999df7. The module summary now reads: int8 leads every tier, then fp8 on Ada, Hopper and Blackwell (sm_89+) and mxfp8 on Blackwell (sm_100+), Ampere (sm_80+) has int8 alone, and nvfp4 is an explicit opt-in that is not in the auto ladder. It also says outright that _AUTO_LADDER is the ordering that ships and the paragraph is only its summary, so the next reader has one place to trust. Comment only, test_diffusion_transformer_quant.py 89 passed.

danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 14, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b999df780d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +214 to +216
((10, 0), (TQ_INT8, TQ_FP8, TQ_MXFP8)), # Blackwell sm_100+ (nvfp4 is explicit opt-in only)
# ((10, 0), (TQ_INT8, TQ_FP8, TQ_NVFP4, TQ_MXFP8)), # restore to re-enable nvfp4 under auto
((8, 9), (TQ_INT8, TQ_FP8)), # Ada sm_89 / Hopper sm_90

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Update user-facing descriptions for the INT8-first ladder

On Ada, Hopper, and Blackwell data-center GPUs where both schemes are supported, this now selects INT8, but the image/video request schema descriptions (studio/backend/models/inference.py:3605-3609 and 4537-4540) and both Precision UI hints (images-page.tsx:3420 and video-page.tsx:3265) still state that Auto selects FP8 on data-center cards. Update these exposed descriptions so users do not make precision or performance decisions based on the previous ladder.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3c9cb87. All four exposed descriptions now name the ladder that ships:

file was now
models/inference.py (image transformer_quant) data-center fp8, consumer/Ampere int8 int8 first on every tier, then fp8 on sm_89+
models/inference.py (video transformer_quant) data-center fp8, consumer/Ampere int8 int8 first on every tier, then fp8 on sm_89+
images-page.tsx Precision hint at least INT8 on a capable GPU; FP8 on data-center cards INT8 on every capable GPU, then FP8 where the card has it
video-page.tsx Precision hint at least INT8 on a capable GPU; FP8 on data-center cards INT8 on every capable GPU, then FP8 where the card has it

test_diffusion_transformer_quant.py 89 passed, formatter fixed point green. The same wording lands on #10883 through a merge of this branch (ec486c7), where the images hint had also gained the pipeline sentence.

danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 14, 2026
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 14, 2026
danielhanchen added a commit to Datta0/unsloth-staging-3 that referenced this pull request Sep 14, 2026
danielhanchen added a commit to Datta0/unsloth-staging-3 that referenced this pull request Sep 14, 2026
danielhanchen added a commit to Datta0/unsloth-staging-3 that referenced this pull request Sep 14, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

Some of the red here is inherited rather than yours. Repo tests (CPU, studio), Shell installer tests and workflow-trigger lint all fail on the same two workflow guards:

FAILED tests/studio/test_uv_cache_discipline.py::test_every_warm_installer_job_restores_the_uv_cache
FAILED tests/studio/test_studio_smokes_do_not_trigger_on_the_training_library.py::test_the_filter_lists_exactly_the_github_paths_the_steps_execute[studio-update-smoke.yml]

That was a main breakage, fixed by #10826, and both pass on current main. Merging main in should clear those three and leave only what actually belongs to this branch.

Collapse the multi-line prose the int8-first change left behind in
diffusion_transformer_quant.py and its tests: the module scheme paragraph,
the _AUTO_LADDER header, _is_consumer_gpu, select_transformer_quant_scheme,
auto_scheme_candidates and the ladder tests. Comments and docstrings only,
no code change.
@danielhanchen

Copy link
Copy Markdown
Member Author

Closing this as superseded. The int8-first ladder is already on main, so there is nothing left here to land, and merging the branch as it stands would regress the frontend.

What I checked before deciding:

  • _AUTO_LADDER is byte-identical on both sides. Main has ((10, 0), (TQ_INT8, TQ_FP8, TQ_MXFP8)), ((8, 9), (TQ_INT8, TQ_FP8)), ((8, 0), (TQ_INT8,)), which is exactly what this branch proposes.
  • _prefer_consumer_scheme is absent from both. Main already dropped it, for the same reason this PR did: once int8 leads every tier, the consumer reorder is dead code.
  • Every test function this branch adds to test_diffusion_transformer_quant.py already exists on main.
  • Merge probe: merging this branch into main and taking main's side on all three conflicts produces a zero net diff against main, so the non-conflicting files contribute nothing either.

The three conflicts are not two different behaviours, they are two wordings of the same change, and main's is the newer one.

The reason to close rather than merge: the only lines genuinely unique to this branch in studio/frontend/src/features/images/images-page.tsx are the pre-#10883 gating,

transformer_quant: opts.kind === "gguf" ? advanced.transformer_quant : undefined,

which #10883 replaced when it landed. Merging this branch would put that back and undo #10883's precision gate.

The measurement that motivated this PR stands and is unchanged, it just arrived on main by another route.

@danielhanchen
danielhanchen deleted the studio-auto-int8-first branch September 17, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant