mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2661] [CLOSED] serve: the Profile page (/profile, opt-in "profile": true): the last request's breakdown as it happens, and a run of tools/strata_profile.py from the page #4198
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4198
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2661
Author: @qiuzan2001
Created: 10/15/2026
Status: ❌ Closed
Base:
main← Head:qiuzan2001/profile-page📝 Commits (2)
f895de3tools: strata_profile.py, one command that says where the time goes on this PC (prompt phases, decode window split, hit rate per turn)8cd4387serve: the Profile page (/profile, opt-in "profile": true): the last request's breakdown as it happens, a run of tools/strata_profile.py and setup's calibration from the page📊 Changes
15 files changed (+4436 additions, -8 deletions)
View changed files
📝
SECURITY.md(+7 -3)➕
bench/results/2026-10-15-profile-rtx-5070-ti-swift-1-5-iq3-s/README.md(+55 -0)➕
bench/results/2026-10-15-profile-rtx-5070-ti-swift-1-5-iq3-s/results.json(+1978 -0)➕
bench/results/2026-10-15-timing-switches-rtx-5070-ti/README.md(+20 -0)➕
bench/results/2026-10-15-timing-switches-rtx-5070-ti/ab_engine.jsonl(+24 -0)📝
docs/COMMUNITY_BENCHMARKS.md(+6 -0)📝
docs/DETAILS.md(+40 -1)➕
serve/profile_page.py(+335 -0)📝
serve/runconfig.py(+1 -0)📝
serve/server.py(+127 -4)➕
serve/test_profile.py(+384 -0)➕
serve/web/profile.html(+71 -0)➕
serve/web/profile.js(+128 -0)➕
tools/strata_profile.py(+816 -0)➕
tools/test_strata_profile.py(+444 -0)📄 Description
What it adds
An opt-in Profile page at
/profile("profile": trueinstrata-<model>.json, orserve/server.py --profile; also a switch in the About tab's Model settings, used from the next start):STRATA_PREFILL_TIMING=1andSTRATA_DECODE_TIMING=1in its environment (a value the user set for either stays), so every request writes its breakdown to the engine log;GET /profile/lastreads the lines from the tail of the engine log with the parsers oftools/strata_profile.py(#2660, which this branch includes: its first commit is that PR);POST /profile/tune(own page only) unloads the model (409 while a request runs, as/unload) and runs setup's calibration in a child process (python -m serve.profile_page --calibrate <config>callssetup.calibrate_config: tools/calibrate.py's measurements, the winners written intostrata-<model>.jsonand remembered in the settings file, exactly assetup.py --calibratedoes). When it ends, the calibrated flags and the config'senvgo into the engine's start command (apply_to_spawn), so the model loads with them on the next request. While it runs the server does not load its engine beside the calibration's (a request gets 503 withRetry-After, as when the GPU is in use by another program),/profile/runand the Settings view'sPOST /configanswer 409, and the page asks before starting (setup's own estimate: roughly 15-30 minutes, longer on a slow card). As setup, the page offers it on NVIDIA only and not for replicas (the status says why);POST /profile/run(Strata's own page only, as/settings: JSON, no foreign Origin, the API key when one is set) startstools/strata_profile.pyagainst this server,GET /profile/statusfollows it and returns the written report (bench/results/<date>-profile-<gpu>-<model>/), shown as the same tables and findings. The API key goes to the tool through its environment, not the command line.Off (the default) nothing is set in the engine's environment and the five paths answer 404, so the default path is unchanged. The page is built like
/api-monitor(same tokens.css, no CDN, server data only as text).Measured (RTX 5070 Ti 16 GB, Ryzen 7 5800X3D, Linux, Strata 0.1.44.1, Swift 1.5 IQ3_S at 262K, INT8 KV,
--kv-resident 32768)The cost of leaving the two switches on,
tools/ab_engine.py, 3 alternating rounds with a restart per arm, greedy, 256 new tokens:So the prompt path pays about 4% for its event marks on this card; the decode's timestamps are within the noise. The raw rows are in the PR (
bench/results/2026-10-15-timing-switches-rtx-5070-ti/); docs/DETAILS.md says so beside the page and tells the user to turn it on while looking, off when done.Real check on the same box: the server started with
--profileprints the switches in its start line;/profile/lastansweredrequest: nullbefore any request and the breakdown of a 64-token answer after it; a run started from the page (POST /profile/run) andGET /profile/statusreturned its lines and the report; a POST with a foreignOrigingot 403. The run from the page (?long=8192, the model already loaded) took 42 s and its findings matched the command-line run's (2K read 43% + 15% waiting for expert copies; decode windows 9.5-10.2 ms of card and 11-18 ms of experts computed on the CPU). A 20-token prompt has no prefill timing line (the page says so and shows the decode window). The Tune button, on the same box from a copy of the config: a second POST while it ran got 409,/healthsaid unloaded, the calibration ended after 681 s with--pcie-frac 0.35, --spec-min-p 0.70, --adapt-every 1, --adapt-swaps 160, --adapt-decay 0.97 (96.6 tok/s)written into the config, the server printed its "tuned for this PC" line, and the next request loaded the engine with those five flags on its command line (checked withps). This check ran before the second review's guards were added; those are covered by the unit tests.Checked
python3 -m unittest serve.test_profile20/20;serve.test_runconfig,serve.test_security,serve.test_monitor,serve.test_lifecycleunchanged (71 together);tools/test_strata_profile.py28/28.node --check serve/web/profile.js.child_envis unchanged and the paths answer 404 (tested).Not done
child_env, but/profile/lastreads the primary engine's log only; not run.profile, the report path read back only from the results folder, a pump race, the server's own host for the tool, the run's end at shutdown, the unmeasured "three minutes", the A/B data not in the repo) are in this revision; a second pass on the tuning button added the no-load guard while it runs, the replica and HIP refusals, the result applied before the run is published as done, the calibration's own variables only, and the wording.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.