Skip to content

Commit ea3e8b1

Browse files
authored
single query benchmark for Claude Code - don't pin model by default
2 parents 9b66ee1 + 9bf8ac2 commit ea3e8b1

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

‎benchmark/README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ retrieval measurably changes the answer's cost and quality.
6767
./single-query-bench-claude.ps1 [-Model <id>] [-Prompt "your query"]
6868
```
6969

70-
- Default model is `claude-opus-4-8`. If the query is omitted, you're prompted for it.
70+
- By default no `--model` is passed, so Claude Code uses its own default model (your `/model`
71+
setting). Pass `--model` / `-Model` to benchmark a specific one. If the query is omitted,
72+
you're prompted for it.
7173
- Follow the on-screen steps. Before each Claude launch the script pauses for a keypress so
7274
you can read the instructions; the TUI then takes over the terminal.
7375
- **In the measured session, do exactly ONE turn** (paste query → wait → `/exit`), or the

‎benchmark/single-query-bench-claude.ps1‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@
2323
[CmdletBinding()]
2424
param(
2525
[string]$Prompt,
26-
[string]$Model = "claude-opus-4-8"
26+
[string]$Model # empty => Claude Code's default model
2727
)
2828

2929
$ErrorActionPreference = "Stop"
3030

31+
# Only pass --model when one was given, so the default follows the user's Claude Code config.
32+
$modelArgs = @(if ($Model) { '--model', $Model })
33+
3134
# --- Environment we will toggle. Capture originals so we can restore them. -----------------
3235
$cacheVars = @{
3336
"DISABLE_PROMPT_CACHING" = $null # keep caching ON ($null => remove if set in env)
@@ -183,14 +186,14 @@ function Invoke-ClaudeRun([string]$label, [string]$query) {
183186
# --- Turn 1: warm-up (writes the TUI prefix into cache) --------------------------------
184187
Write-Host "WARM-UP: in Claude, type hi and press Enter; wait for the reply, then /exit." -ForegroundColor Yellow
185188
Wait-Key " Press any key to start the WARM-UP session..."
186-
Start-Process -FilePath $ClaudeExe -ArgumentList '--model', $Model, '--append-system-prompt', $nonce -WorkingDirectory $WorkingDir -NoNewWindow -Wait
189+
Start-Process -FilePath $ClaudeExe -ArgumentList ($modelArgs + '--append-system-prompt', $nonce) -WorkingDirectory $WorkingDir -NoNewWindow -Wait
187190

188191
# --- Turn 2: measured (reads the prefix warm; keep it to ONE turn) ---------------------
189192
Set-Clipboard -Value $query
190193
Write-Host "MEASURED: the query is on your clipboard. Paste it (Ctrl+V), press Enter, wait, then /exit." -ForegroundColor Yellow
191194
Write-Host " Do exactly ONE turn so the cost is just the query." -ForegroundColor DarkGray
192195
Wait-Key " Press any key to start the MEASURED session..."
193-
Start-Process -FilePath $ClaudeExe -ArgumentList '--model', $Model, '--append-system-prompt', $nonce -WorkingDirectory $WorkingDir -NoNewWindow -Wait
196+
Start-Process -FilePath $ClaudeExe -ArgumentList ($modelArgs + '--append-system-prompt', $nonce) -WorkingDirectory $WorkingDir -NoNewWindow -Wait
194197

195198
# Read official metrics; retry in case the config write lags process exit.
196199
$r = $null

‎benchmark/single-query-bench-claude.sh‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ while [ $# -gt 0 ]; do
3232
esac
3333
done
3434

35+
# Only pass --model when one was given, so the default follows the user's Claude Code config.
36+
MODEL_ARGS=()
37+
[ -n "$MODEL" ] && MODEL_ARGS=(--model "$MODEL")
38+
3539
CACHE_VARS="DISABLE_PROMPT_CACHING DISABLE_AUTOUPDATER ENABLE_PROMPT_CACHING_1H"
3640

3741
# Indexed arrays are fine on bash 3.2 (macOS); associative arrays are not, so we avoid them.
@@ -173,7 +177,7 @@ invoke_run() {
173177
# --- Turn 1: warm-up (writes the TUI prefix into cache) --------------------------------
174178
echo "WARM-UP: in Claude, type hi and press Enter; wait for the reply, then /exit."
175179
pause " Press any key to start the WARM-UP session..."
176-
"$CLAUDE_BIN" --model "$MODEL" --append-system-prompt "$nonce" || true
180+
"$CLAUDE_BIN" ${MODEL_ARGS[@]+"${MODEL_ARGS[@]}"} --append-system-prompt "$nonce" || true
177181

178182
# --- Turn 2: measured (reads the prefix warm; keep it to ONE turn) ---------------------
179183
if copy_clip "$PROMPT"; then
@@ -185,7 +189,7 @@ invoke_run() {
185189
echo "Do exactly ONE turn, then /exit."
186190
fi
187191
pause " Press any key to start the MEASURED session..."
188-
"$CLAUDE_BIN" --model "$MODEL" --append-system-prompt "$nonce" || true
192+
"$CLAUDE_BIN" ${MODEL_ARGS[@]+"${MODEL_ARGS[@]}"} --append-system-prompt "$nonce" || true
189193

190194
# Read official metrics; retry in case the config write lags process exit.
191195
local out="" i

0 commit comments

Comments
 (0)