Skip to content

Commit 1870df8

Browse files
committed
fix(evals): allow long reasoning contexts
1 parent e223e5b commit 1870df8

3 files changed

Lines changed: 50 additions & 2 deletions

File tree

benchmarks/benchmark_lib.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ except Exception:
757757
}
758758

759759
# Compute the context length for eval-only mode.
760-
# Uses the requested benchmark context capped at the model's native max.
760+
# Eval-only runs use at least EVAL_MIN_MODEL_LEN, capped at the model's native max.
761761
# Sets EVAL_MAX_MODEL_LEN (needed by run_lm_eval).
762762
# Echoes the computed value for scripts to capture.
763763
#
@@ -769,6 +769,15 @@ compute_eval_context_length() {
769769
native_max=$(get_native_max_context_length "$model")
770770
native_max="${native_max:-0}"
771771

772+
# Fixed-sequence benchmark windows are often too short for reasoning evals.
773+
# In eval-only mode, raise the context budget without changing recipe configs
774+
# or throughput runs.
775+
local eval_min="${EVAL_MIN_MODEL_LEN:-32768}"
776+
if [ "${EVAL_ONLY:-false}" = "true" \
777+
] && [ "$benchmark_ctx" -lt "$eval_min" ] 2>/dev/null; then
778+
benchmark_ctx="$eval_min"
779+
fi
780+
772781
if [ "$benchmark_ctx" -eq 0 ] 2>/dev/null; then
773782
benchmark_ctx="${native_max:-0}"
774783
fi

utils/evals/EVALS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ cat ./evals/agg_eval_all.json | jq '[.[] | select(.hw == "B200")]'
151151
| `EVAL_FRAMEWORK` | `lm-eval` | Eval framework to use |
152152
| `EVAL_TASKS_DIR` | `gsm8k,gpqa_diamond_cot_n_shot,aime26` | Comma-separated lm-eval task names, or one task YAML path |
153153
| `EVAL_RESULT_DIR` | `/tmp/eval_out-*` | Output directory for eval results |
154-
| `EVAL_MAX_MODEL_LEN` | `16384` | Max context for eval (set by `compute_eval_context_length`) |
154+
| `EVAL_MAX_MODEL_LEN` | computed | Max context passed to the eval client and, where supported, the serving engine |
155+
| `EVAL_MIN_MODEL_LEN` | `32768` | Minimum context for eval-only reasoning tasks; capped at the model's native maximum and does not affect throughput runs |
155156
| `EVAL_CONCURRENT_REQUESTS` | `64` | Concurrent requests during eval; a space-separated list enables sequential batched evals against one live engine |
156157
| `EVAL_LIMIT` | empty | Limit eval to first N instances (smoke tests); empty = full set |
157158

utils/evals/test_batched_eval.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,44 @@ def test_workflow_concurrencies_are_independent_of_eval_metadata(
190190
assert any("missing result files for concurrency: 1, 4" in error for error in errors)
191191

192192

193+
def test_eval_context_has_reasoning_floor_capped_by_native_max(
194+
tmp_path: Path,
195+
) -> None:
196+
benchmark_lib = (
197+
Path(__file__).resolve().parents[2] / "benchmarks" / "benchmark_lib.sh"
198+
)
199+
script = r'''
200+
source "$BENCHMARK_LIB"
201+
get_native_max_context_length() { echo "$NATIVE_MAX"; }
202+
203+
export EVAL_ONLY=true
204+
export EVAL_MIN_MODEL_LEN=32768
205+
export NATIVE_MAX=100000
206+
printf 'eval=%s\n' "$(compute_eval_context_length test-model 9472)"
207+
208+
export NATIVE_MAX=16000
209+
printf 'native-cap=%s\n' "$(compute_eval_context_length test-model 9472)"
210+
211+
export EVAL_ONLY=false
212+
export NATIVE_MAX=100000
213+
printf 'throughput=%s\n' "$(compute_eval_context_length test-model 9472)"
214+
'''
215+
result = subprocess.run(
216+
["bash", "-c", script],
217+
cwd=tmp_path,
218+
env={**os.environ, "BENCHMARK_LIB": str(benchmark_lib)},
219+
check=True,
220+
capture_output=True,
221+
text=True,
222+
)
223+
224+
assert result.stdout.splitlines() == [
225+
"eval=32768",
226+
"native-cap=16000",
227+
"throughput=9472",
228+
]
229+
230+
193231
def test_validate_scores_checks_threshold_for_every_concurrency(
194232
tmp_path: Path,
195233
monkeypatch,

0 commit comments

Comments
 (0)