Skip to content

Studio: classify shared MTP fit OOM as VRAM fallback - #10143

Closed
wasimysaid wants to merge 2 commits into
unslothai:mainfrom
wasimysaid:fix/shared-mtp-vram-fallback
Closed

wasimysaid wants to merge 2 commits into
unslothai:mainfrom
wasimysaid:fix/shared-mtp-vram-fallback

Conversation

@wasimysaid

Copy link
Copy Markdown
Collaborator

Summary

  • recognize llama.cpp's shared-MTP sizing omission followed by a coupled draft-load GPU OOM as Auto's existing drafter_no_vram downgrade
  • keep forced speculative modes on runtime_error, preserve binary_outdated precedence, and avoid attributing unrelated GPU OOMs to the drafter
  • document the expanded status contract and add captured-log regression coverage

Root cause

A shared Qwen3.8 MTP head has no independent token_embd.weight, so llama.cpp cannot measure it alone. llama.cpp fits the target without that extra model, then loads the head against the target and can OOM because the target consumed the available VRAM. Studio already retries successfully without MTP, but previously reported that recovery as a runtime incompatibility.

The classifier is intentionally narrow: it requires the ordered shared-tensor, omitted-fit, draft-load, in-draft GPU OOM, and draft-failure sequence, and applies only when Auto selected speculation.

Validation

  • python -m pytest backend/tests/test_gpu_init_crash_message.py -q — 149 passed
  • ruff check on all changed Python files
  • py_compile on all changed Python files
  • git diff --check
  • independent standards/spec review with chatgpt/gpt-5.6-sol (medium), findings addressed, clean re-check

Hosted runners do not provide the CUDA VRAM/model footprint needed to reproduce the original 2.6 GiB allocation live; the regression uses the captured llama.cpp failure sequence and checks positive and negative classification paths deterministically.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 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-01T11:42:05.759917Z 64c8043 Manual request
ℹ️ 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.

wasimysaid added a commit to wasimysaid/unsloth that referenced this pull request Sep 1, 2026

@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: 9b7c3f4dde

ℹ️ 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".

@wasimysaid
wasimysaid force-pushed the fix/shared-mtp-vram-fallback branch from 2da4627 to ecee446 Compare September 1, 2026 11:10

@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: 1028f94d74

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@wasimysaid
wasimysaid force-pushed the fix/shared-mtp-vram-fallback branch from 1028f94 to d366f7c Compare September 1, 2026 11:25
wasimysaid added a commit to wasimysaid/unsloth that referenced this pull request Sep 1, 2026
@wasimysaid
wasimysaid force-pushed the fix/shared-mtp-vram-fallback branch from 5db2a5d to b4b3a17 Compare September 1, 2026 11:29
@wasimysaid

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: b4b3a175d1

ℹ️ 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".

@wasimysaid

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 64c804339b

ℹ️ 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

Copy link
Copy Markdown
Member

Confirmed this hits studio/backend/core/inference/llama_cpp.py where the shared-head OOM still comes back as a runtime or outdated-binary verdict, and the ordered-marker guard looks appropriately narrow. Could you drop the unrelated assertion reformatting in test_mcp_session_resources.py and test_mcp_upgrade_compat.py so the branch is just the classifier change?

@danielhanchen

Copy link
Copy Markdown
Member

Confirmed the shared-head OOM still lands on the runtime_error branch in studio/backend/core/inference/llama_cpp.py, so the reclassification is the right direction, and note #10149 is reserving VRAM for the same shared heads up front. Could you drop the unrelated assert reformatting in test_mcp_session_resources.py and test_mcp_upgrade_compat.py so the branch stays on the classifier change?

@wasimysaid wasimysaid closed this Sep 14, 2026
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.

2 participants