Skip to content

Studio: show the --fit placement search instead of counting its header reads as loaded weights - #18725

Merged
danielhanchen merged 5 commits into
unslothai:mainfrom
oobabooga:studio-fit-search-progress
Nov 22, 2026
Merged

danielhanchen merged 5 commits into
unslothai:mainfrom
oobabooga:studio-fit-search-progress

Conversation

@oobabooga

@oobabooga oobabooga commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Problem

When a GGUF load uses llama-server's --fit on, the load toast shows weights loading at 15 to 50 MB/s with a 10 to 15 minute ETA while no weights are being read. On a load that cannot fit (Inkling-2-Mini at 800K context, #18689), every retry repeats this, so the failure looks like slow storage.

Load progress during the --fit search and the weight load, before and after

Root cause

LlamaCppBackend.load_progress reports max(RssFile, rchar) of the llama-server process as bytes loaded. Before loading any tensor, --fit tries dozens of layer placements and re-reads the GGUF header for each one. rchar counts those reads (about 0.45 GB over 20 s for Inkling-2-Mini), and the frontend turns them into a rate and an ETA.

Fix

  • _drain_stdout follows the load stages in llama-server's log: the --fit search, from its first line to its common_fit_params: result line (llama_params_fit: on b8864 and older), then the first load_tensors: loading model tensors after it, where rchar and RssFile are recorded as a baseline. At verbosity 5 each probe prints its own load_tensors line, so that line only counts outside a search.
  • load_progress returns phase: "fit" with 0 bytes during the search, and measures both counters from the baseline after it.
  • This needs trace verbosity (4), which Studio sets by default. At lower verbosity the log does not show both ends of the search, so progress is reported as before.
  • The load toast and the inline status show "Finding a GPU layer split that fits in memory." without a bar, rate or ETA. The inline status now shows any label that has no percent, so the unknown-size download label ("N GB downloaded") also appears there. The MCP load poller reports the fit phase instead of the finished download.

Verification

Inkling-2-Mini UD-Q4_K_XL (18.3 GB), RTX 6000 Ada + RTX 3090, 800K context, /api/inference/load-progress polled every 0.25 s on main and on this branch. Each load made 6 llama-server attempts, 4 of them with --fit on:

--fit attempt main: bar during the search this branch
1 0.14 to 0.47 GB at 15.0 MB/s over 21.5 s phase: "fit", 0 bytes, 18.7 s
2 0.15 to 0.43 GB at 16.8 MB/s over 16.8 s phase: "fit", 0 bytes, 20.5 s
3 0.08 to 0.50 GB at 22.6 MB/s over 18.4 s phase: "fit", 0 bytes, 24.9 s
4 0.05 to 0.98 GB at 50.3 MB/s over 18.4 s phase: "fit", 0 bytes, 50.9 s

After each search, the branch counted the weights up to 17.5 to 17.6 GB. The same load at --verbosity 5 (35 probe load_tensors lines in one search) also stayed in fit until the real load, and at --verbosity 2 it reported as on main.

Unit tests cover the stage parser, including the verbosity 2 and 5 log sequences and the b8864 markers, and the MCP poller.

Before / after in the shipped UI

Load toast during the --fit search and the weight load, main vs this PR

Both trees' frontends, load started from the chat picker with a cached Qwen3-4B Q4_K_M GGUF. /api/inference/load-progress answers what each tree's own backend returned when a real llama-server trace (Colab L4, --fit on --fit-target 20000 -lv 4, prebuilt b12588) was replayed through its _drain_stdout and load_progress, slowed 4x. On main the search shows 0.2 GB loaded with a rate and ETA (mapped CUDA libraries in RssFile plus about 30 MB of header re-reads across 5 probes); on this branch it shows the placement search, then counts the weights from the first real read.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T05:01:35.418047Z f819781 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.

@oobabooga

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: f819781bfa

ℹ️ 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
danielhanchen merged commit f409a47 into unslothai:main Nov 22, 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