Repository navigation
Studio: show prompt progress, live generation details and where a GGUF loaded - #14909
Merged
danielhanchen merged 31 commits intoOct 24, 2026
Merged
Conversation
oobabooga
marked this pull request as draft
October 23, 2026 04:56
Member
Author
|
Reached Codex review convergence at oobabooga#409. |
oobabooga
marked this pull request as ready for review
October 24, 2026 03:19
…PU weights Under mmap, CPU_Mapped logs the span from the first to the last host tensor, which covers GPU tensors in between once experts spill, so the placement row overstated RAM (25 GiB for 4.3). [skip ci]
…e deepest one A drafter can have more layers than its target (Gemma 4 E2B, 35, for 26B A4B, 30); llama-server loads the main model first, so the first allocated block is the main model's. [skip ci]
danielhanchen
added a commit
to Etherll/unsloth
that referenced
this pull request
Oct 24, 2026
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 24, 2026
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 24, 2026
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 24, 2026
Member
|
pre-commit.ci run |
danielhanchen
added a commit
to Etherll/unsloth
that referenced
this pull request
Oct 24, 2026
Closed
oobabooga
added a commit
to oobabooga/unsloth
that referenced
this pull request
Nov 2, 2026
This was referenced Nov 2, 2026
Closed
danielhanchen
added a commit
to oobabooga/unsloth
that referenced
this pull request
Nov 2, 2026
…rows, not the rate so far (unslothai#16450) A review of unslothai#14909 reported that the "time left" while a GGUF reads a long prompt is too optimistic: it showed 26 s when about 42 s remained. ## Problem "Processing prompt N% · Xs left" runs short for the whole prompt, and by more the longer the prompt is. On a 30K-token prompt it read 38% to 49% short at every point. ## Cause `prefillSecondsLeft` divides the remaining tokens by llama-server's `prompt_per_second`, the average rate since the pass started. That assumes every remaining token costs what the earlier ones did. Each prompt token attends to every token before it, so the cost per token grows with its position: the time per 2,048-token batch rose about linearly in every run below (0.60 to 1.55 ms per token on one prompt). A rate over a recent window still lags the growth; on the same samples it stayed 15% to 49% short. ## Fix - `routes/inference.py`: the prefill frame also carries llama-server's `time_ms`, its own clock since the pass started. The client cannot time the frames itself, because they reach it through the 0.25 s stall poll, which sends only the newest sample. - `generation-progress.ts` and the runtime store: each timed sample of a pass adds to eight running least-squares sums, and the time left comes from the fit `c + a*x + b*x^2` of elapsed time over tokens (a straight line if the curve bends the wrong way). - Two limits keep a few samples from overreaching: the cost per token grows only across as many tokens again as the samples span, then holds; and the fit replaces the rate so far gradually, from the fourth timed sample, fully once the pass has six samples and 30% of the prompt read. ## Behavior boundaries - The percent, the token counts and the prompt speed in Generation details are unchanged. - Whether the label shows at all is still decided on the first samples, so short prompts keep "Working...". - Early in a pass the estimate is main's, moving to the fit as above (fully about 45% into the 27K-token prompts below). There it still reads short, as on main. An older llama-server without `time_ms` keeps main's estimate throughout. ## Verification Unless noted, runs on the CPU, gemma-3-270m-it UD-Q4_K_XL, fresh Studio homes, main at `6401ceda29`. Live A/B through the page, alternating, the same 27K-token prompts, the label read every 100 ms. Error of the shown time left against the time that actually remained, from 30% to 82%: | | main | this PR | | --- | --- | --- | | Mean | -31% | -9% | | Mean absolute | 31% | 12% | | Range | -41% to -21% | -33% to +15% | Below 30% this branch read -43% to -10%, never over. A replay of llama-server's own samples from 10 prompts (two models, Studio's llama-server flags, three runs recorded by Studio) gives the same picture: main -34%, this branch -9% (mean absolute 11%). One slow batch, through the same functions (2,048 tokens per 500 ms, batch 4 taking 250 ms longer): | | Fit without the limits | This PR | | --- | --- | --- | | 32K tokens | 18.1 s shown for 6.0 s left | at most +48% | | 131K tokens | 270.8 s for 30.0 s left | at most +36% | On an RTX 6000 Ada, with Studio's llama-server flags: each prompt's progress samples, replayed through both versions the way the page receives them (the newest sample every 0.25 s). The cost per prompt token grows on the GPU too, 2.5x across 58K tokens on gemma-4-E2B and about 4x across 107K on Qwen3.6-35B-A3B. Error from 30% to 83%: | Model | Prompt | Read in | main | this PR | | --- | --- | --- | --- | --- | | gemma-4-E2B Q4_K_M | 58K tokens | 4.4 s | -39% | -12% | | Qwen3.6-35B-A3B UD-Q4_K_XL | 58K tokens | 8.5 s | -32% | -6% | | Qwen3.6-35B-A3B UD-Q4_K_XL | 107K tokens | 21.8 s | -46% | -11% | | Qwen3-8B Q4_K_M | 30K tokens | 6.3 s | -43% | -14% | Tests: - New: a replay of two recorded prompts, where the estimate never does worse than the rate so far from 30% on and stays within 20% from 45%; the slow-batch case above; and the fit's lifecycle across repeated frames, an untimed llama-server and a new pass. They fail on main, as do two updated backend tests. - Frontend tests in files touching the runtime store, adapter or progress: 2,351 of 2,352 pass; `save-temporary-chat.test.ts` fails the same way on main (the bundled Node 22.12 lacks `stripTypeScriptTypes`). Backend live-progress, frame-spoofing and chat-run supervisor suites: 110 passed. Typecheck passes; ESLint has no new findings. Not tested: Metal, and prompts with images. ## Screenshots The same 27K-token prompt on both sides; the legend gives the time that actually remained:  <!-- generation-evidence:start --> ## Verified before and after Separate Studio installs at base `6401ceda29` and head `71aedfe885`, using identical recorded progress frames. At 53%, the estimate changes from 12s to 20s left; the recorded completion leaves 20.57s at this sample. Counts and prompt rate are unchanged. This is a replay through the real UI, not a model-throughput measurement.  <!-- generation-evidence:end --> --------- Co-authored-by: Daniel Han <[email protected]>
danielhanchen
added a commit
to Etherll/unsloth
that referenced
this pull request
Nov 2, 2026
…and update it during short replies (unslothai#16449) A review of unslothai#14909 reported that the reply footer "looks buggy" while a reply streams, with Generation details on. A screen recording shows two separate defects. ## Problem 1. **The branch picker moves.** While a regenerated reply streams, the `< 2/2 >` picker shifts right when the live line appears, shifts further as the line grows, and snaps back to the left when the reply finishes. In a narrow chat column the line pushes the picker onto a second row. 2. **The live count is stale.** A reply of a second or two shows "1 token" for the whole reply, or for a full second before the next figure. ## Cause 1. The footer renders `AssistantMessageTime`, `LiveGenerationLine`, `BranchPicker`, `AssistantActionBar` in that order, so the growing live line sits before the picker. 2. `_PrefillProgressSignal` sends a decode frame at most once per `_LIVE_DECODE_FRAME_INTERVAL_S = 1.0`, and the first sample goes out at once. That sample is llama-server's first token, which has no decode rate yet, and it holds the line until the interval runs out. The next sample's rate covers one decode step, which with Studio's default draft model reads about 10x low. ## Fix - `thread.tsx`: the live line renders after the picker, in the slot the hidden action bar leaves while streaming, so its text never moves the picker. The footer's picker takes the row's 32 px height (`h-8`), so it also stays put when the live line wraps onto a row of its own. - `routes/inference.py`: a pass's first decode sample opens the interval instead of being sent, and samples without a rate are dropped, so the first frame goes out one interval into decoding with a measured rate. A new prompt pass (the next round of a tool loop) starts its own wait. The interval drops from 1.0 s to 0.25 s, the stall poll's period. ## Behavior boundaries - The finished footer retains its controls and timing badge. The picker uses a 32 px height throughout, so a narrow footer whose action bar wraps can gain up to 8 px in that row compared with the former 24 px picker. - The prompt-progress label gives way to "Working..." when the first decode frame arrives: at least 0.25 s after the first token, once llama-server reports a decode rate, instead of at the first token. This only shows for a reply that decodes with nothing visible yet, such as a tool call being written. - Durable runs store up to four decode frames a second instead of one, next to one stored chunk per streamed token. ## Verification Live A/B with Playwright on fresh Studio homes, gemma-3-270m-it UD-Q4_K_XL on the CPU, Generation details on; main was `d8efd157ab` for the measurements and `6401ceda29` for the screenshots. Each run regenerated a reply so the picker shows. - Live frames on a 300-word reply: main at 0.20 s ("1 token"), 1.22 s and 2.10 s; this PR from 0.39 s ("22 tokens · 83.6 tok/s"), then every 0.2 to 0.35 s. A one-second poem showed "1 token" throughout on main, and four updates here. - Decode speed, the same prompt alternated four times: main averaged 124.3 tok/s, this PR 129.9 tok/s. Tests: - New: the first decode frame waits one interval past the first token, per prompt pass (backend), and the footer order is picker, live line, action bar (frontend; these suites render no DOM). Both fail on main. Three existing backend tests now expect the held first frame. - The backend suites touching live progress and the SSE frame paths: 1088 passed, 1 skipped. `generation-details` and `reply-times-preference`: 25 passed. Typecheck passes; ESLint has no new findings. The contributor's original checks did not cover GPU hosts, macOS or Windows. Additional takeover checks: 111 targeted backend tests and 25 frontend tests passed locally; scoped staging ran 11 backend and 21 frontend tests successfully on each of Linux, macOS and Windows. An exclusive remote Tesla T4 tiny-model run exercised the production live-progress callback: greedy outputs matched in all 15 runs, peak allocated memory was equal, and the 1.51% median decode change was within repeated-base variation. This measures callback overhead during inference, not full Studio HTTP/persistence throughput. Chromium, Firefox and Edge each reproduced the base layout defect and stable head picker; the WebKit scripted-stream fixture failed on base with access-control errors, so no WebKit pass is claimed. The switchboard finished at exact head `9fcbf6b750` with CURRENT / NO_REGRESSION: 66 SAME, 4 DOM_ONLY_DIFF, 1 FAIL_BOTH and 2 FLAKY. The shared failure is the compaction notice not appearing after six turns on both arms; no compaction correctness claim is made. The remote model journeys ran on a Colab T4-HM. ## Screenshots The footer while the reply streams, 0.6 s and 1.6 s after the live line appears, then finished:  The same at 400 px:  <!-- takeover-footer-evidence:start --> ## Verified footer layout Fresh, isolated Studio builds at merge base `6401ceda29` and functional PR head `9fb03a89a`, with the same scripted reply and progress frames. The later commits through `9fcbf6b750` change comments and an internal docstring only, verified by the comment-only AST checks. This image verifies layout; backend timing is covered separately by the base/head progress tests. The picker moves 347.8 to 467.1 px to the right as the live text grows on the base, and stays at x=0 on the PR. At 400 px the base puts the picker below the wrapped live line; the PR keeps it above the line at y=0. Both replies contain exactly "A short reply for the footer check."  <!-- takeover-footer-evidence:end --> --------- Co-authored-by: Daniel Han <[email protected]> Co-authored-by: Daniel Han <[email protected]>
danielhanchen
added a commit
to Etherll/unsloth
that referenced
this pull request
Nov 2, 2026
… pass (unslothai#16451) A review of unslothai#14909 reported that when a reply reaches Max Tokens and automatically continues, the timing tooltip describes only the continuation. Their reply had 128 tokens in the first part and 11 in the continuation, and the tooltip showed "11 tokens / 348 ms" for the 139-token answer. This predates unslothai#14909. ## Problem A continued reply (Max Tokens auto-continue, or Continue / Resume) shows one merged answer. Its badge, timing tooltip and response details still describe only the last request, under labels like "Tokens" and "Total" that read as totals for the whole answer. ## Cause Each continuation is a new request with its own `streamStartTime`. The adapter builds the reply's `timing`, `serverTimings` and `responseDetails` from that request alone, while the text starts from the resumed partial. The continuation request already carries the resumed reply's reasoning time (`reasoningDuration`), which is why "Worked for" covers the whole answer; nothing carried its timing. ## Fix - New `utils/continued-timing.ts`: reads a reply's own figures from its metadata and adds them to a pass's figures. Counts and times add up, the first token is the answer's first, and a rate is the time-weighted mean of the passes' rates, which keeps llama.cpp's definition (decode steps over decode time). - `thread.tsx`: Continue carries the resumed reply's figures as `ContinuationRequest.priorTiming`. - `chat-adapter.ts`: a pass counts its own output (its `usage`, or an estimate of only the text it appended) and adds the earlier passes. The response details start at the first pass, and their duration is the passes' own time, not the wait before a manual Continue. - A Stop keeps only a reply's last streamed metadata, and an error's has no server figures, so every streamed yield and the error's also carry `resumeTiming`, the passes so far, for Resume to read. ## Behavior boundaries - A reply that was never continued keeps exactly its own figures. - Context usage (the context meter, and the details sheet's token section) stays per request. - A continuation interrupted by a page reload is finished by the recovery path from the backend run, which knows only that request; it keeps the last pass's figures, as on main. - A stopped reply still shows no timing badge, as on main. - With Generation details off the stream has no per-token timings, so a stopped pass adds its time and estimated tokens but not llama-server's Generation and Speed figures. ## Verification Live A/B with Playwright on fresh Studio homes, gemma-3-270m-it UD-Q4_K_XL on the CPU, the first request capped at 64 tokens so it stops on `length` and auto-continues, as in the report; main was `d8efd157ab` for the first table and `6401ceda29` for the second and the screenshot. | Continued reply | main | this PR | | --- | --- | --- | | Tokens | 278 (continuation only) | 263 (64 + 199) | | Total | 2.03 s (continuation only) | 2.20 s (613 + 1,583 ms) | | First token | 98 ms (the continuation's) | 171 ms (the first pass's) | | Context usage output | 278 | 199 (per request) | Stop pressed during the continuation, then Resume: | Resumed answer | main | this PR | | --- | --- | --- | | Tokens | 616 (last pass only) | 898 (64 + 121 estimated + 713) | | Total | 4.26 s (last pass only) | 6.32 s (all three passes) | Tests: - New `continued-reply-timing.test.ts`: two and three passes adding up, the report's 128 + 11 merging to 139, a stopped and a broken-off reply's carried figures read by Resume, a never-continued reply left unchanged, and the adapter's wiring (checked in the source, since the adapter only runs against a live stream; the Stop path is exercised end to end above). - The 2,205 frontend tests in files touching continuation, the adapter, the timing tooltip, the details sheet or run recovery pass. Typecheck passes; ESLint has no new findings. Not exercised live: three continuations by Max Tokens alone, and a pass that fails with an error rather than a Stop. ## Screenshots The legend's first-pass figures come from the stored messages:  <!-- continued-reply-timing:verified --> ### Additional verification A regression in the submitted aggregation moved a failed continuation's reply timestamp into the future. Fixed in 1e381c3 by preserving the finish time when combining active durations. The regression test failed with 13,548 instead of 9,348 before the fix and passes afterward. Both comment-reduction passes are complete and passed the comment-only checks. At head a38b0d4, fresh isolated Studio builds at merge base 6401ced and the PR head received the same scripted 128-token first pass and 11-token continuation. Both sent two requests and rendered identical answer text and byte-identical system prompts. Request bodies matched after removing the isolated homes' provider and thread IDs. The tooltip changed from 11 to 139 tokens, and from 300ms to 4.10s generation. These supplied timing values verify aggregation; they are not a model speed benchmark. The same two-pass differential also passes in Chromium, Firefox, Microsoft Edge and WebKit, with unchanged request content. The affected continuation, timing and reply-time tests pass (149 tests); TypeScript checking passes. The broader frontend suite passed 14,618 tests with zero failures and one Windows-only test skipped on Linux. Linux, macOS and Windows scoped staging tests passed for the functional fix.  <!-- studio-regress:start --> ### Studio UI regression check Base `6401ceda2` vs head `a38b0d4dd`. Functional: **NO_REGRESSION**, 1 visual change(s), 0 text-only change(s). Only steps whose screenshots differ are shown. **continued_reply_timing**: Same scripted response in fresh base and head installs. These supplied server timings prove aggregation, not model speed. Chromium, Firefox, Edge and WebKit pass; requests and answer text are unchanged. Facts: `tokens`: {'before': 11, 'after': 139}; `generation_ms`: {'before': 300, 'after': 4100}  <!-- studio-regress:end --> --------- Co-authored-by: Daniel Han <[email protected]>
yermakoffivan
pushed a commit
to yermakoffivan/unsloth
that referenced
this pull request
Nov 2, 2026
…ip and the weight placement row (unslothai#16452) A review of unslothai#14909 reported that in another language its new strings stay English, while the Generation details setting itself is translated. ## Problem With the UI in German, a GGUF chat shows "Processing prompt 15% · 4s left · 2.049 / 13.626 tokens · 2.710 tok/s": German digits, English words. The same goes for "Working...", the live line under a streaming reply, every row of the reply's timing tooltip including the new "Stop reason" values, and the "Weight placement" row in Run settings. ## Cause unslothai#14909 kept these strings in the code, as its description says ("The live strings are English, like the 'Working...' they replace"). `generation-progress.ts` and `partial-offload.ts` build the sentences around numbers already passed through `toLocaleString`. `message-timing.tsx` had no translation at all before unslothai#14909, which added "Stop reason" and "Draft accepted" to it. ## Fix - A `generationStats` namespace in `en.ts` holds whole templates with placeholders ("{count} tokens", "{eta} left", "{gpu} of {total} layers on the GPU, {cpu} on the CPU"), so each language can order the words around the numbers. - `formatPrefillDetails`, `formatPrefillTimeLeft`, `formatLiveDecode` and `describePlacement` take the `t` function from `useT()`, as `scheduled-tasks/results.ts` does, so they stay plain functions for the tests. The Run settings panel passes the memory pool as `"unified"` / `"shared"` instead of English words. - The prompt line ("Working..." included, since the two alternate in one span), the live line, the whole timing tooltip with its button label, and the Weight placement row read from the catalog. - All 24 overlays carry the new keys, in a separate commit as the i18n README asks, reusing each overlay's existing words for token, prompt, cache, layers, experts, draft and unified memory. - The catalog has only a one/other pair, which cannot give Russian "2 токена" and "21 токен" next to "5 токенов". So Russian, Ukrainian, Polish, Czech and Arabic put the count after a label ("токены: 21") wherever it stands before a noun. ## Behavior boundaries - English output is unchanged; the existing English assertions in `generation-details.test.ts` pass as they were. - "tok/s", GPU, CPU, RAM, VRAM, GiB, MiB and the compact durations ("12s", "2m 10s") stay as they are, as elsewhere in the app. - Only these four pieces are moved. The rest of the Run settings panel, the reply's action bar and "Cancelled." were English before unslothai#14909 and still are. ## Verification Live A/B with Playwright on fresh Studio homes, gemma-3-270m-it UD-Q4_K_XL on the CPU, a 13.6K-token prompt, Generation details on, UI in German; main was `d8efd157ab` for the run below and `6401ceda29` for the screenshot. With this PR the prompt line reads "Prompt-Verarbeitung 15% · noch 4s · 2.049 / 13.645 Tokens · 2.520 tok/s", the live line "130 Tokens · 115,1 tok/s · Draft 107/128 akzeptiert (84%)", and the placement row "Platzierung der Gewichte · Alle 19 Schichten auf der CPU". The same four places render in Japanese, and the tooltip keeps its layout with the longer German labels. Tests: - New: the formatters and the placement description render the German overlay's templates with German number formatting; the prompt line, tooltip, placement row and `generation-progress.ts` no longer hold the English sentences; in Russian, Ukrainian, Polish, Czech and Arabic no count stands before a noun. - `i18n:check:strict` passes with no missing keys. The 830 tests in files touching these formatters, components or the locale files pass. Typecheck passes; ESLint has no new findings. - The startup bundle stays within budget; the i18n chunk grows by 1.6 KB raw (0.6 KB transfer). Not checked by a native speaker: the 24 overlays. ## Screenshots UI in German on both sides:  <!-- generation-evidence:start --> ## Verified before and after Separate Studio installs at base `ac7229860e` and integrated head `7cdeff4ae7`, with German selected and identical recorded progress frames. The fitted estimate from unslothai#16450 stays at 20s on both sides; the prompt-progress and draft-acceptance labels become German while all numbers remain identical. These pictures verify presentation, not model throughput.   Validation at this head: 26 focused generation-details tests pass, full frontend suite 14,644 passed and zero failed, production build passes, and strict parity passes for all 25 catalogs. The merge resolution explicitly checks the fitted estimate renders as "noch 20s". <!-- generation-evidence:end --> --------- Co-authored-by: Daniel Han <[email protected]>
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Nov 11, 2026
Related to unslothai#16055. ## Problem Studio knows where a loaded GGUF's weights are, but the only lasting readout is the "Weight placement" row in Run settings (unslothai#14909), and it sits behind a switch that is off by default. In a [Reddit thread](https://www.reddit.com/r/unsloth/comments/1xra6ua/inference_speed_cratered_after_recent_update/) about slow generation, people could not tell whether the model had spilled to the CPU. They tried to read it from the memory estimate, which is a forecast. ## Fix - The "Weight placement" row always shows for the loaded GGUF, in the same grey text for every placement. - The switch that used to gate it now only controls the live speed lines, so "Detailed speed and loading info" becomes "Detailed speed info" in all 25 locales. That label is from unslothai#16888, so please say if you prefer another name. - The "partly on CPU" and "none of the layers fit" warnings now end with the weight amounts, for example "Model weights: 1.9 GiB on the GPU, 2.8 GiB on the CPU." These are totals, and they count the weights only. This is the idea from unslothai#16064 (thanks @debojyoti-dev), worded so it is also correct with unified memory. - A MoE load with expert weights in RAM, which llama.cpp counts as fully on the GPU, now says so on its success toast. - A load that llama.cpp logs as fully offloaded while every buffer is in system memory, on a machine with a GPU, now gets the existing "llama.cpp could not use it" warning. There are no backend changes, and which loads get a warning is otherwise the same. ## Before and after Main (`011129b355`) vs this PR (`7e9fd96cc5`), with the same real load on both sides. A model that is fully on the GPU: <img width="3504" height="1072" alt="placement_01_fully_on_gpu" src="https://raw.githubusercontent.com/oobabooga/unsloth/pr-media/pr/studio-gguf-placement-visible/placement_01_fully_on_gpu-b3ed33f4ace9.png" /> 14 of 37 layers on the GPU: <img width="3504" height="1124" alt="placement_02_partly_on_cpu" src="https://raw.githubusercontent.com/oobabooga/unsloth/pr-media/pr/studio-gguf-placement-visible/placement_02_partly_on_cpu-a21ce5ab7fd0.png" /> A MoE model with the expert weights of 24 layers in RAM: <img width="3504" height="1124" alt="placement_03_moe_expert_weights_in_ram" src="https://raw.githubusercontent.com/oobabooga/unsloth/pr-media/pr/studio-gguf-placement-visible/placement_03_moe_expert_weights_in_ram-94f22098f15b.png" /> ## Testing - Live in Studio on Linux with an RTX 3090: the three loads above, and the row after a page reload. A small tool makes the card report less free VRAM than it has, so a model that would fit lands partly on the CPU. - 7 new frontend tests. The failed GPU backend case is covered by these tests only. - `typecheck`, `i18n:check:strict` and the frontend and `tests/studio` tests that cover these files pass. - Not tested on Windows or macOS. ## Before and after, separate installs Merge base `011129b355` vs this PR `dbd790c8ed`, each built from its own tree, "Detailed speed info" left at its default (off). Run settings with gemma-3-270m GGUF loaded on an NVIDIA L4. Main shows no placement; this PR shows all 19 layers on the GPU and the weight split: <img width="620" alt="pr17449_gpu_l4" src="https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/17449/pr17449_gpu_l4_crop-95099eb1a905.png" /> Run settings with Qwen3-0.6B GGUF loaded on a CPU-only Linux machine. This PR says all 29 layers are on the CPU, with 0.5 GiB in RAM: <img width="660" alt="pr17449_cpu_only" src="https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/17449/pr17449_run_settings_crop-4524523ed93c.png" />
danielhanchen
added a commit
that referenced
this pull request
Nov 13, 2026
…17703) ## Summary Three tests in `studio/backend/tests/test_load_progress_ready_fraction.py` fail now and then on PRs that do not touch the llama.cpp backend (seen on a `(Python 3.13, g-l)` run for #16564, an Appearance theme change): ``` test_mmap_phase_reports_raw_rss_fraction assert 1.0 == 0.08 test_progress_fraction_is_monotonic assert 1.0 == 0.9 test_none_when_rss_unreadable assert {'phase': 'mmap', 'bytes_loaded': 10000, ...} is None ``` The tests build a backend whose fake process has pid 4321 and stub `_read_rss_bytes`. Since #14909, `load_progress` also reads `_read_load_bytes(pid)`, which opens the real `/proc/<pid>/io`. These tests never stubbed it. When a process with pid 4321 happens to exist on the runner and is readable, its `rchar` (far above the 10,000 byte fake shard) becomes `bytes_loaded`, so the fraction reads 1.0 and the "RSS unreadable" case no longer returns `None`. `load_progress` is right to take the larger of RSS and bytes read; the tests were missing a stub. ## Change - An autouse fixture stubs `LlamaCppBackend._read_load_bytes` to `None` for this file. These tests pin the RSS arithmetic; the read-bytes probe has its own coverage in `test_llama_weight_placement.py`. - The fake process now uses the test's own pid instead of 4321. That pid is always live and readable, so a test that forgets the stub fails every time instead of only when the pid happens to be taken. Test only, no product code changes. ## Testing - `test_load_progress_ready_fraction.py`: 9 passed. - Main's file with the pid set to a live one fails exactly the three tests above, with the same assertions as CI. - This file with the fixture made non-autouse fails the same three.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#14582 asks for a verbose view of what the engine is doing: prompt and load progress, how much of the model is offloaded, and prompt and reply speeds, as an optional setting.
What changed
Prompt progress. A GGUF chat shows "Processing prompt N% · 12s left" instead of "Working..." while the prompt is read. The percent covers only the part the prompt cache did not reuse, so a follow-up in a long chat starts at 0%. llama-server already streamed
prompt_progress, but the chat stream only turned it into: prefill-progresscomments, which the client drops. UI chat streams now get ageneration_progressframe for each prefill batch (_PrefillProgressSignal(live=True),_stall_wait_framesinroutes/inference.py). The label appears only once the rate so far puts the rest of the prompt at 2 s or more, then stays until the first token, so a short prompt keeps "Working..." instead of flashing a percentage.Generation details switch. Settings > Chat > Display > "Generation details", off by default. Search finds it under "verbose", "developer" and "tok/s". When it is on:
timings_per_token, which was only requested when the API Monitor was listening;parse_weight_placementreads the--fitverdict and the buffer sizes from the llama-server log into new status fields (overflow_layers,expert_cache_mib,gpu_weights_mib,host_weights_mib).--fit's "N overflowing" on the last device includes the output layer, which spills nothing, so the count leaves it out. A build without GPU offload, which logs only the buffers, gets the row too.Reply timing tooltip. Adds "Stop reason" and "Draft accepted". "First token" is now the time from sending to the first token; the server's prompt time stays under "Prompt eval".
Load progress. The bar stopped moving once the weights went to VRAM, because
load_progress()compared resident memory with the file size, and it showed nothing without/proc. It now counts what llama-server has taken in, against the shards plus any projector, draft model, LoRA and control-vector files, including ones chosen throughLLAMA_ARG_*variables:rchar) and file-backed RSS (RssFile). Full RSS also counts the pinned CUDA buffer for weights kept in RAM, which is allocated before any of it is read.read_bytes). The working set reaches the model size before llama.cpp has read anything.proc_pid_rusage).The toast reads "X of Y GB loaded".
Notes
generation_progressframes: one per prefill batch, at most one per second while decoding.Verification
test_live_generation_progress.pyandtest_llama_weight_placement.pyare new. The related suites give 6,746 passed and 3 failed; the same 3 (one diffusion gated-base test, two video offline-load tests) fail on main.i18n:check:strictandbundle:checkpass, and the 3,132 tests in the 221 files covering model load paths, the chat runtime store and the thread pass, including the newgeneration-details.test.ts. ESLint reports nothing on the changed lines.load_progress(), sampled every 25 ms during realllama-serverloads, rose steadily through each load.UNSLOTH_MOE_CACHE=on, where the row reads "all experts in RAM (18 GiB expert cache on the GPU)". In the screenshot load,--fitprints "8 overflowing" and the RAM buffer is 5,639.40 MiB, which is exactly the token embeddings plus the expert tensors of the 7 layers the row names. On an M1 with Metal, the 2,603.5 MiB GPU and 497.3 MiB CPU buffers read as "3.0 GiB in unified memory".Screenshots
Main, then this branch with Generation details off and on. gemma-4-26B-A4B-it Q8_0 on a 24 GB RTX 3090, where the automatic fit keeps expert weights of 7 layers in RAM. Each run used a new Studio data home and a new en-US browser profile.
Load progress, 22 s into a cold load. All three loads took about 25.5 s; main sat at 26% from 6 s while its estimate grew from 12 s to 49 s.
Weight placement, with the switch on.
Settings.
Prompt progress, 3.5 s after sending a 5.8K-token prompt.
Live line, 3 s into the reply. Speeds vary between runs on this busy host.
Timing tooltip.
Before and after (merge base vs this branch)
Two fresh Studio installs, gemma-3-270m-it UD-Q4_K_XL on the CPU, the same 9,596-token prompt on both sides, Generation details switched on.
Prompt progress. Main shows "Working..." for the whole prompt read; this branch shows the percent, time left, tokens and speed.
Live line under a streaming reply.
Settings > Chat > Display.