Model Parameter Sweeps & Determinism
Conversational AI, Agent Memory & Multi-Turn Testing β Day 2
Sweep temperature, top_p, seed, and max_tokens across repeated runs to measure output variance, verify seed reproducibility, and catch mid-JSON truncation failures.
Uncontrolled sampling parameters turn deterministic customer-servicing workflows into flaky systems. Today you will sweep combinations of temperature, top_p, seed, and max_tokens to enforce repeatability SLAs and detect truncated JSON payloads.
The official reference codebase for Day 2 is hosted in the repository. Clone the repository and navigate to day-2-model-parameters/test_day2.py to run the working solution.
git clone https://github.com/777abhi/agent-memory-testing-roadmap.git
cd agent-memory-testing-roadmap/day-2-model-parameters/test_day2.pyRun Model Parameter Sweep Assertions
Execute the Day 2 parameter sweep suite to validate determinism and truncation detection.
npm run test:day2sweep = run_parameter_sweep(
intent="dispute_status",
param_grid=[ModelParams(temperature=0.0, top_p=1.0, seed=42, max_tokens=64)],
runs_per_config=6,
min_exact_match_rate=1.0,
max_truncation_rate=0.0,
)- Verified exact-match repeatability for zero-temperature and fixed-seed configurations.
- Measured output variance across unseeded high-temperature runs to quantify sampling flakiness.
- Caught finish_reason=length truncation and broken JSON closing delimiters when max_tokens is under-provisioned.
π§ Knowledge Check
What failure mode does asserting finish_reason and valid JSON closing delimiters catch during a max_tokens sweep?