Repository navigation
Unsloth Studio / Desktop: add an Evals tab to Benchmarks that scores a GGUF with lm-eval-harness - #12521
Open
LeoBorcherding wants to merge 180 commits into
Open
Unsloth Studio / Desktop: add an Evals tab to Benchmarks that scores a GGUF with lm-eval-harness#12521LeoBorcherding wants to merge 180 commits into
LeoBorcherding wants to merge 180 commits into
Conversation
…nd parallel-slot sweeps Reloads the loaded GGUF once per setting, streams timed completions and keeps llama-server's own timings. Rows that Studio fell back on are skipped with the reason instead of charted. Prompts rotate across runs so the ngram cache can't inflate its rows by copying a repeated answer. Phase 1 of unslothai#11646.
…ng and a setup side panel Runs are saved as they go in two new studio.db tables (benchmark_runs, benchmark_results) behind /api/benchmarks/runs, so a stopped or crashed sweep keeps the rows it finished. Auto-tune tries off, MTP 1-4, ngram and MTP + ngram, picks the fastest (a simpler setting within 3% wins) and applies it to chat's Run Settings. A DSpark tuning sweep covers draft depth and draft KV dtype. Rows are bounded so an out-of-VRAM spill cannot freeze the machine: load and generation time limits, a throughput floor, OOM labelling, and larger context rows skipped after the first OOM. Generations use chat's sampling settings. The chart footer and exports list every Run Settings value plus GPU, backend, runtime, OS, threads and RAM. The page is one screen: a setup side panel, the model strip, and the results, with the live queue drawn as placeholder rows in the chart.
… at the menu's available height
…s a RAM offload sweep - Benchmark and History tabs. Setup, results and a Train-style run preview share the Benchmark tab; History is a card grid with each run's winner, speed-up and row bars. - Chat's model picker in the tab bar: benchmark any on-device GGUF and quant, loaded first with chat's Run Settings. The picked quant now reaches the load and Apply to chat. - RAM offload sweep: Studio's fit, then MoE expert layers on CPU from all to none (n_cpu_moe, scaled to the model's MoE layer count), GPU layer steps for dense models. Rows pin 8K context, run from least VRAM to most, and skip hungrier rows after an OOM. VRAM after each load is recorded and shown in the table. - Header shows every GPU, VRAM and RAM used/total, CPU threads and the llama.cpp backend. - The setup card fits the window and scrolls its Compare list instead of running off it. - The chart stops growing past its natural width; queued rows draw as quiet lanes. - The runs list carries each row's mean tok/s so History needs no per-run fetch.
- Number fields clamp when you leave them, not on every keystroke, so clearing one to type a new value no longer snaps it to the minimum. - The Fastest tile names the baseline when nothing beats it (an offload sweep's Studio fit); the ratio tile says "nothing beat it" instead of a bare 0.04x. - A sweep with one family (offload, KV, context) lists its rows flat; single-row families (DSpark, DFlash) keep their full names. - Footer and History show the context rows actually ran at (8K pinned, or "varied"). - History marks a run cut short by Stop as "Stopped early", not "Complete". - "vs Studio auto" keeps its capital; only "speculation off" reads lowercase mid-sentence. - Table cells no longer wrap; tighter padding so all eight columns fit.
…and the chart fits the window
…sloth into studio-benchmarks-page
…and context limit for picked models - Benchmark runs that select a different GGUF via tuneModel left chat pointed at the benchmark target after finishing. The Restore-after option now reloads the model chat originally had open. - With prompt rotation on, each swept variant was fed a different subset of the built-in prompts, so a throughput difference could come from prompt length rather than the setting. Every variant now runs the same prompt sequence. - In context and offload sweeps, one unrelated generation error (e.g. a transient 500) marked the row as out-of-memory and skipped all remaining valid sizes/placements. Only genuine memory/limit/floor failures now trigger that skip. - When benchmarking a GGUF other than the one loaded in chat, the context-length sweep used the resident model's context window. It now uses the selected model's own context length from its GGUF header.
…nal-save race - Auto-tune's verdict card would label a cancelled run "Auto-tune picked" and let you apply a winner chosen from partial data, because it keyed off `finishedAt`, which the runner sets even on cancel. It now also requires every row to have reached an end (`ranToEnd`), matching the history grid. - The first measured sample was counted twice in the live chart and mid-run snapshots because the live run shared its results array with the runner, which had already pushed that sample before emitting it. The live run now copies the array on start so each sample is appended once. - A slow or in-flight mid-run save could complete after the final save and overwrite the finished benchmark run with a partial snapshot (`finishedAt: null`, fewer rows). The final save now drains any queued checkpoint save first, so it is always the last write.
…r an auto OOM, and skip the relative spill floor during warm-ups - A Stop during the benchmark's initial model load (or metadata read) left Chat on the benchmark target model even with "Restore chat's settings after" enabled, because the swap happened outside the restore scope. The swap and setup now run inside that scope, and a swap-in-progress is tracked so an aborted load is still restored. - When the offload sweep's automatic "Studio auto" row ran out of memory, every manual CPU-offload/GPU-layer row after it was wrongly skipped as a context failure, so the lower-VRAM placements the sweep exists to test never ran. Only context sweeps now mark a context as failed; offload rows recover from an auto-placement OOM. - A variant with a slow cold start (e.g. modes that initialize a drafter or ngram cache on the first request) could be killed during warm-up for running below 20% of the fastest measured row, before its real throughput was ever measured. The relative spill threshold now applies only to measured runs; the absolute floor still guards warm-ups.
…story winner, exclude errored rows from auto-tune, and skip clamped parallel-slot rows - The Context length sweep kept the previously selected model's context steps when the target model changed or when the GGUF header resolved after the sweep was picked, so it could benchmark the wrong window. Context rows now rebuild whenever the resolved max context changes. - History cards reported the fastest non-baseline row as the winner even when the baseline was actually fastest, showing a slower setting with a below-1x ratio. Cards now pick the fastest row overall and compare separately, matching the results panel. - Auto-tune could pick a candidate that measured one sample and then failed on a later run, and apply that failed setting to Chat. The verdict and the Apply action now only consider rows that ran to completion. - On llama.cpp builds without --kv-unified, the Parallel slots sweep clamped every row to one slot yet charted 1/2/4 as distinct results. Rows whose requested slot count exceeds what the server actually served are now skipped with the reason instead of being charted.
…model metadata resolves, and persist runs that only produced failure diagnostics - When the sweep finished but the original chat model failed to reload, the failure was swallowed and the UI implied settings were restored. The runner now reports the restore failure and the Benchmarks page shows it, while still keeping the completed run. - For context and offload sweeps on a newly picked model, Run was clickable before the model's metadata loaded, so the sweep could start using the resident model's context window or leftover offload rows. Run is now disabled for those sweeps until the picked model's header resolves. - A benchmark run where every variant failed or was skipped before generating anything was discarded, losing the failure reasons. Such runs are now saved to History; a run cancelled before doing anything is still dropped.
This is a rough first start of the benchmarking feature — it is riddled with bugs and unfinished in basically every corner. Expect things to be broken all over the place; this is not in any kind of working or polished state yet.
Mounts the lm-eval page as a Quality tab beside Benchmark and History instead of its own /benchmark route and sidebar entry, and fits it to current main: - Its tables are eval_runs / eval_samples. benchmark_runs is already the speed sweeps' table in the same studio.db, and CREATE TABLE IF NOT EXISTS would have left whichever feature ran second reading the other's schema. - The HF token comes from the hub token store (hfToken left the training store). - scoreColor was used but never defined; added. - Washes and fixed lengths follow the contrast and UI-size settings, as the style tests require. - Dropped studio/AGENTS.md, the .gitignore lines and the install.ps1 mode change, which were local to the fork.
…fails - On the Benchmarks page, if reading a non-resident GGUF's header failed, the request was swallowed and Run stayed disabled forever for context and offload sweeps with no explanation. The setup now surfaces the error and offers a Try again button that refetches, instead of silently blocking the run.
…g per completion - Context sweeps could enable Run and build their rows on the resident model's window when the picked GGUF's header resolved without a readable context length (not downloaded, unreadable header, expired lease). Run is now blocked with a retry until the picked model's own context window is known. - A variant's mean/range/sample count discarded any repetition missing server timings whenever another repetition had them, so the displayed figures could rest on an arbitrary subset of runs. The client-side rate now stands in per completion (both the live aggregation and the stored history means), so every requested run counts.
…ginal chat load before sweep
- The Benchmarks history endpoints (`GET /runs`, `GET /runs/{id}`) returned the stored run verbatim, exposing the loaded GGUF's absolute host path in `model` (and `config.tuneModel`) to any API-key caller, the same filesystem identity the inference status route already redacts. Both endpoints now redact those model paths for API-key callers while leaving browser sessions untouched.
- When a benchmark sweep finished, the code restored Chat's original model by recomputing its load from the live chat store, which Chat's own status polling had meanwhile overwritten with each benchmark variant's KV/context/speculative/offload settings. The original load is now snapshotted before the first model swap and used for restoration, so Chat comes back exactly as it was.
…he unused sidebar label
… rows from being treated as OOM - Benchmark run IDs were timestamp-only, so two runs started in the same millisecond collided and overwrote each other's stored results. Run IDs now carry a random suffix. - A RAM-offload row that ran slowly by design (experts in system RAM) tripped the 2 tok/s safety floor and was then treated as out-of-memory, skipping all the more GPU-heavy placements after it, including ones that would have fit and run fast. The floor now still stops that row but no longer propagates it as an OOM for offload sweeps.
…ffload rows, and rank only completed rows as history winners - A benchmark started right after opening the Benchmarks page could snapshot Chat's settings before they finished loading, sweeping (and restoring) with store defaults instead of Chat's real config. runBenchmark now awaits chat-settings hydration before it reads the store. - RAM-offload rows inherited Chat's -ngl/--n-cpu-moe pass-through args, which the load route promotes over the per-row layer count, so the 25/50/75% and all-on-GPU rows all ran the same inherited placement. Offload rows now drop those inherited offload flags since the sweep owns placement. - A benchmark row that recorded a measurement and then errored or was cancelled could still be ranked as the run's winner on the history card. Winner and speedup now consider only rows that completed every rep, while partial samples stay in the chart.
…l-row winner selection - The client-side throughput fallback counted SSE stream chunks instead of tokens, so rows without server timings could report chunk/s as tok/s and mis-rank the winner. It now uses the exact `usage.completion_tokens` from the terminal include_usage chunk, falling back to the chunk counter only if usage is absent. - The results page could crown a row that errored or was cancelled after one measured rep as the Fastest result, since aggregation keeps partial samples. It now ranks only rows whose outcome is `done` for the Fastest card, speed-up and headline, matching the History and Auto-tune pages, while still charting the partial rows. - Draft-depth sweeps could chart several rows that all ran at the same depth: if chat's extra llama-server args carried `--draft-max` or `--spec-draft-n-max`, that value was inherited into every benchmark load and overrode each row's requested depth. Rows that own speculative decoding now strip those inherited depth flags from the base args before applying their own, the same way the offload sweep strips inherited placement flags.
# Conflicts: # studio/backend/routes/benchmarks.py
…n the headline metric in run details
# Conflicts: # studio/frontend/scripts/check-bundle-budget.ts # studio/frontend/src/i18n/locales/ar.ts # studio/frontend/src/i18n/locales/de.ts # studio/frontend/src/i18n/locales/es.ts # studio/frontend/src/i18n/locales/fr.ts # studio/frontend/src/i18n/locales/he.ts # studio/frontend/src/i18n/locales/hi.ts # studio/frontend/src/i18n/locales/it.ts # studio/frontend/src/i18n/locales/ja.ts # studio/frontend/src/i18n/locales/ko.ts # studio/frontend/src/i18n/locales/pt-br.ts # studio/frontend/src/i18n/locales/ru.ts # studio/frontend/src/i18n/locales/sv.ts # studio/frontend/src/i18n/locales/zh-CN.ts
…d KV flags, and tidy Auto-switch and preview swap the server without a /load call, so a sweep's later rows could run on another model; both now 409 while a sweep holds the lease. KV and draft-cache rows drop chat's inherited -ctk/-ctv/-ctkd/-ctvd, which last-wins over the row. The progress bar counts only a failed row's missing reps, and a second Run click during the lease round trip is ignored. The per-group strip functions become one stripFlags. Adds the nav label to the 11 newer locales so i18n:check:strict passes, and tightens comments.
- Headline metric falls back to the metric name before the filter (MMLU-Pro, MATH, BBH) and knows IFEval's prompt_level_strict_acc; samples keep only the headline filter. - Picker offers GGUFs only and locks during a run; the HF token, model source, checkpoint fetch and download branch are gone from the run path. - Progress events no longer fill the log buffer; ownsRun clears when a run ends; deletes bump a runs version the scoreboard refetches on, and failed deletes stay listed with their error. - Run params are validated (422); bbh and mmlu_pro are generation tasks; truthfulqa_mc2 is curated; charts name the headline metric; tqdm progress only counts the eval worker's bars. - Dead keys, dialog, barrel and constants removed; benchmark.* translated into all locales; hardcoded English moved onto t(); "Run Eval".
Collaborator
Author
|
Pushed
|
… Studio branding from a desktop source
…ght, so no lease is claimed under it
This branch has not been deployed
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.
Adds Evals to the Benchmarks page: run any lm-evaluation-harness task against a GGUF through Unsloth Studio's own llama-server and compare scores across models and quants. MMLU, MMLU-Pro, HellaSwag, ARC-Challenge, GSM8K and TruthfulQA are listed first; every other lm-eval task is searchable. Scoring is lm-eval's own.
Stacked on #11808 (Benchmarks page, config sweeps). Until that lands, this diff includes its commits. Phase 3 of #11646.
Original work by @dotVansh (LeoBorcherding#82), plus his sampling fix from LeoBorcherding#595; styling, integration and the fixes below on top.
What it does
routes/benchmark.py,core/benchmark/): runs lm_eval with theggufbackend (gguf: support modern llama.cpp logprobs format (fixes #1437) EleutherAI/lm-evaluation-harness#4012), so it talks to the local llama-server and scores with exact teacher-forced loglikelihoods instead of resolving an HF tokenizer. API under/api/benchmarks/evals; runs and per-sample results in their owneval_runs/eval_samplestables./v1/tokenizepassthrough for the harness, through_LlamaUpstreamlike the other llama-server routes, so it carries the server's key and gets one respawn if llama-server dies mid-run./v1/completionsfills any sampling field a request leaves out from the model's chat recommendations, and the harness leaves them out. Evals now send presence/frequency penalty 0, repeat_penalty 1, top_p 1, top_k 0, min_p 0 unless the task sets them. Without this, Qwen3.5 ran gsm8k with presence_penalty 1.5.ad8737ae7f, the first commit with the gguf backend; no release has it yet. If it's missing,/runanswers 400 with the install command.features/benchmarks/components/bar-chart.tsx, pulled out of the sweeps chart), the tiles are the sharedstat-tile.tsx, and the live log is a sharedcomponents/log-pane.tsxthat matches Settings > Logs in light and dark. The matplotlib graph is kept only as a "Styled PNG export" download.How it looks
Unsloth Studio (web) on a Colab T4, Llama-3.2-1B-Instruct Q4_K_M and Q8_0, at
bb79649781.Scoreboard, two quants of one model:
Scores
Colab T4, through
/rununless noted; ± is lm_eval's stderr.Repeat runs aren't bit-identical (copa 0.75 to 0.77 on the same model): four slots share one KV cache, so batch composition moves the float math.
Known gaps
Hardware coverage
No hosted GitHub runner has a GPU. The Strix Halo runner on ooba's fork doesn't run Unsloth Studio, so this table is the test report.
ad8737ae7f30135ad424/slots; tokenize auth; llama-server killed mid-eval ×5; Stop and the 409s; every UI view in light and dark at 1024 to 192087bb5bad2Not run: AMD, Windows, macOS, Unsloth Desktop.
Tests
Measured at
6ff267104d(up to date with main), macOS, Apple M5: frontend typecheck,npm test0 fail, build,bundle:check,i18n:check:strict; backendtest_benchmark_evals.py,test_benchmark_parse.py,test_benchmark_runs.py,test_llama_server_api_key_default.pypass. On the T4 at30135ad424: the same backend set, 47 passed.Full results with logs: LeoBorcherding#136 (comment 6456810510).