A serving benchmark gives a table of numbers for each setting. You must read the table and decide. In this lab you read real SGLang 0.5.22 runs of Qwen3-8B on one NVIDIA L4. You find where throughput stops rising, where the latency SLO breaks, what FP8 gives, and whether a smaller prefill chunk helps.
The data comes from manuals/sglang-101/capture/gpu/summary/l4.json in this repository. support.py has a copy of the rows that the lab needs. Each value is the median of three seeds. The MIXED rows also keep the min and max of the three seeds.
Task
Write five helper functions and answers().
gains(ys)returns a float array of length n - 1. Entry i is y_{i+1} / y_i - 1.saturation_point(xs, ys, min_gain=0.05)finds the first step i with gain strictly belowmin_gain. It returnsxs[i], the last level before that step. If no step has a gain belowmin_gain, it returnsxs[-1].largest_within(xs, ys, limit)returns the largestxwhoseyis less than or equal tolimit. If noymeets the limit, it returnsNone.pct_change(new, old)returns 100 \cdot (new - old) / old.ranges_overlap(a, b)takes two dicts with the keys"min"and"max". It returnsTruewhen a_{min} \le b_{max} and b_{min} \le a_{max}.
Then do the experiment in answers(). Use the helpers.
- Change the concurrency from 1 to 64 in
LOAD["default"]. Measureoutput_throughput. Report the saturation point withmin_gain = 0.05assaturation_default. - Do step 1 again for
LOAD["fp8"]. Reportsaturation_fp8. - In
LOAD["default"], measurep99_ttft_msat each concurrency. Report the largest concurrency withp99_ttft_mswithinSLO["ttft_ms"]asslo_concurrency_default. - In
LOAD["default"], measuregoodput_rps. Report the concurrency with the highest goodput asbest_goodput_concurrency_default. If two levels have the same goodput, use the lower concurrency. - At concurrency 32, divide the FP8
output_throughputby the defaultoutput_throughput. Report the ratio asfp8_speedup_c32. - Change the prefill chunk from the default (4096 tokens) to 1024 tokens. Compare
MIXED["chunk-1024"]withMIXED["default"]at the same rate. Use the"median"field. Report the mean over the three rates ofpct_changeinmedian_ttft_msaschunk_ttft_change_pct. Report the same mean foroutput_throughputaschunk_throughput_change_pct. The new value is the chunk 1024 value. The old value is the default value. - For each rate, test if the seed ranges of
median_ttft_msfor the two settings overlap. Report the number of rates with an overlap aschunk_overlap_rates.
Input and output
| Name | Type | Shape | Meaning |
|---|---|---|---|
xs |
list of numbers | (n,) |
the levels of the variable that you change, in increasing order |
ys |
list of floats | (n,) |
the measured value at each level, all above 0 for gains |
min_gain |
float | scalar | the smallest relative gain that counts as a rise |
limit |
float | scalar | the SLO bound, in the unit of ys |
new, old |
float | scalar | the changed value and the base value, old is not 0 |
a, b |
dict | keys min, max |
one seed range each |
gainsreturns a float array of shape(n - 1,).saturation_pointandlargest_withinreturn one element ofxs.largest_withincan returnNone.pct_changereturns a float.ranges_overlapreturns a bool.answers()returns a dict with the eight keys above. Each value is a Pythonfloat.
Constraints
2 <= n <= 20forgainsandsaturation_point.- Do not change the input lists.
- Do not round the answers. The checks accept a relative difference of
1e-6from the reference run. - Use the data in
support.pyonly. Use numpy and the standard library only.
Examples
gains([13.42, 31.2, 61.54])[1.32488823 0.9724359 ]saturation_point([1, 2, 4, 8], [10.0, 20.0, 20.5, 30.0])2The gain from 2 to 4 is 0.025, which is below 0.05. The series rises again at 8, but the rule stops at the first low gain.
largest_within([1, 2, 4, 8], [100.0, 900.0, 1000.0, 1200.0], 1000.0)4pct_change(37411.99, 35999.18)3.9245616150145577answers()["saturation_default"] is 32.0.