mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2660] [CLOSED] tools: strata_profile.py, one command that says where the time goes on this PC (prompt phases, decode window split, hit rate per turn) #4197
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#4197
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/2660
Author: @qiuzan2001
Created: 10/15/2026
Status: ❌ Closed
Base:
main← Head:qiuzan2001/strata-profile📝 Commits (1)
f895de3tools: strata_profile.py, one command that says where the time goes on this PC (prompt phases, decode window split, hit rate per turn)📊 Changes
6 files changed (+3315 additions, -0 deletions)
View changed files
➕
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)📝
docs/COMMUNITY_BENCHMARKS.md(+6 -0)📝
docs/DETAILS.md(+16 -0)➕
tools/strata_profile.py(+816 -0)➕
tools/test_strata_profile.py(+444 -0)📄 Description
What it adds
python tools/strata_profile.py: one command that says where the time goes on this PC. It starts the server with the user's settings plusSTRATA_PREFILL_TIMING=1andSTRATA_DECODE_TIMING=1in the engine's environment (the switches docs/DETAILS.md describes under "Where a decode window's time goes"), sends a few typical requests through the HTTP API, reads the engine's own lines for each one, and writesbench/results/<date>-profile-<gpu>-<model>/README.md+results.json:--long N, 0 for none), then 128 tokens (decode at a long context, the KV streaming hit)The report groups the prompt read's GPU time (experts streamed over PCIe, dequant, expert GEMM, attention, GDN, other), splits the decode window (the card, the experts computed on the CPU, the draft, the adaptive tier, other) with the hit rate and PCIe share, and ends with findings in words that name the setting on each path (the ones
setup --calibratemeasures where it does). The tokens per second in the report are measured with the switches on; the report says so and points to the bench for speeds.--verify-profileaddsSTRATA_VERIFY_PROFILE=1;--urlwith--engine-log FILEreads a server that is already running (without the log the report has the API's figures and no breakdown).It reuses
tools/strata_bench.py(the HTTP client, the calibrated prompt sizes, the agent session's text, the machine facts, the redaction). The server starts from a temporary copy of the config (0600, deleted at the end): the config is read, never written;--expert-profile-saveis dropped for the run as the bench does (#2088); the engine log goes to a temporary file. The KV streaming line is cumulative over the process, so the report takes the difference between two lines for the long request's own share.Measured (RTX 5070 Ti 16 GB, Ryzen 7 5800X3D, 76 GB RAM, Linux, Strata 0.1.44.1, Swift 1.5 IQ3_S at 262K, INT8 KV,
--kv-resident 32768)The example report is in the PR:
bench/results/2026-10-15-profile-rtx-5070-ti-swift-1-5-iq3-s. Three runs (two with an earlier revision of the tool) agree to a few percent.The long request's KV streaming: 96% of its 838,104 block reads from VRAM, 119 MiB from RAM. Agent session: the hit rate per turn runs from 51% (turn 0, right after the system prompt's read) to 86% (turn 4); follow-up turns read 1,469-3,380 tokens each. The run takes about 3 minutes after the model has loaded (36 s load, 2.5-3 min of requests).
Checked
python3 tools/test_strata_profile.py: 28/28 (the parsers on real engine lines, the grouping, the findings, the run against a fake server that writes an engine log; no GPU).tools/test_strata_bench.py17/17 unchanged.--verify-profile, the last with the final code): every request's lines matched (prefill timing, host staging, decode timing, GPU stages, the prompt summary, the hit rate, KV streaming); the written report has no home folder, user or host name; the temporary config copy was gone at the end.Not done
prefill timingline gets an empty breakdown and the API's figures, as the tests cover).--batchservers: the decode timing line is per request, the tool sends one request at a time, so it should work, but it was not run.The standalone companion, Strata Profile Studio (Python standard library only), reads this tool's reports and compares runs against the noise floor of the PC, with a sign test over the agent turns.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.