Baseten Trace Replay
Use baseten_trace to replay Parquet-exported completion traces against /v1/completions with fixed-schedule timing.
Supported Input
The loader expects a Parquet file with these core columns:
timestamp_start_unix_mspromptinput_tokensoutput_tokens
Common optional columns:
provided_session_idpoor_man_session_idtotal_hashesblock_sizerequest_canceledduration_e2e_msduration_ttft_msoutput_text
Replay Semantics
- Requests are grouped into sessions by whichever of
provided_session_id/poor_man_session_idshows the stronger repeated-session signal; ties preferprovided_session_id. - If neither column repeats (or the chosen column is null for a row), the loader generates a fresh per-row session ID.
- All timestamps are normalized to
ms since first event in file. - Rows inside each session are sorted by normalized timestamp before replay.
promptis replayed as the literal completion prompt.output_tokensbecomes bothmax_tokensandmin_tokens. Ifmax_oslcaps the row, both values use the capped output length. Rows withoutput_tokens=0(e.g. canceled requests) are floored to 1, sincemax_tokensmust be at least 1.total_hashesis forwarded as per-row request body metadata underhash_ids.block_sizeis forwarded per row when present.request_canceledis retained in trace metadata but is not filtered out.- Per-row request metadata is forwarded through
Turn.extra_bodyand merged after endpoint-levelextravalues, so replay metadata wins when keys collide.
output_text is preserved in the trace model for debugging and offline validation, but AIPerf still measures a fresh model response during the benchmark.
Timing model
By default replay is open-loop: every request is scheduled at its absolute recorded timestamp, treating the trace as a fixed event log (but see the known limitation below).
--no-open-loop-replayselects closed-loop back-pressure: each continuation turn fires a think-time delay after the prior turn completes. Think-time = recorded start-to-start gap minus the prior turn’s recordedduration_e2e_ms, clamped by--inter-turn-delay-cap-seconds. Use closed-loop when replayed service times differ from recorded ones (e.g. A/A comparisons) and sessions must stay causally ordered.--replay-speedup Ndivides all timestamps and inter-turn delays byN(e.g.10replays a ~2h trace in ~12 minutes) without touchinghash_ids, so KV-cache fidelity is preserved.--max-idle-gap-cap-seconds Scollapses any global dead-air gap between consecutive requests (across all sessions) to at mostSseconds.Sis replay wall-clock seconds, applied after--replay-speedupcompression — the replay never idles longer thanSreal seconds regardless of speedup.--trace-session-sample-ratio Rkeeps a fractionRof whole sessions, preserving multi-turn integrity. Sampling is only deterministic across runs with a fixed--random-seed.--omit-kv-hintsstops forwardinghash_ids/block_sizeKV-cache hints in request bodies (some strict frontends reject unknown parameters).--force-min-tokens(default) pinsmin_tokensto the recorded output length so replayed generations match recorded lengths;--no-force-min-tokenslets EOS end generations naturally (some servers rejectmin_tokens).--open-loop-strictadditionally treats every trace row as an independent single-turn session so ALL requests (not just each session’s first turn) fire at their absolute recorded timestamps, even if earlier turns of the same recorded session have not completed. This trades away multi-turn session grouping and session metrics.
Known limitation: without --open-loop-strict, a session’s continuation turns fire at max(scheduled time, prior turn completion) — an open-loop timestamp inside a session cannot preempt an in-flight prior turn.
Command
The completions endpoint type already targets /v1/completions; if your gateway serves completions at a non-default path, add --endpoint <path>.
Notes
- Session stickiness still works because rows are grouped into multi-turn conversations.
- For completion traces that already contain the fully expanded historical prompt, AIPerf replays that prompt verbatim rather than reconstructing history from prior turns.