Honor the concurrency option in evaluate() - #6
Open
ruanmartinelli wants to merge 2 commits into
Open
Conversation
The concurrency option was accepted in EvalConfig but silently ignored; cases always ran serially. Now up to config.concurrency cases run at once within each model (default 1, preserving the old serial behavior); models are still swept one at a time so per-model rate limits stay predictable. - add mapConcurrent to utils: an order-preserving worker-pool map - extract the per-case body of evaluate into runCase so it can be scheduled through the pool - validate concurrency as a positive integer - update the types comment and README row that said 'not yet honored' Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015XMPpi4PX2bWwAoMLaZZ4k
Swap the hand-rolled mapConcurrent pool for p-map, the battle-tested equivalent. Behavior is unchanged: order-preserving, at most config.concurrency cases in flight, rejections propagate. The evaluate-level concurrency tests stay as the behavior contract; the pool's own unit tests go with it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015XMPpi4PX2bWwAoMLaZZ4k
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EvalConfig.concurrencywas accepted but silently ignored — cases always ran serially, which makes real evals (network-bound model calls) slow. This wires it up.What
p-map(the library's first runtime dependency): order-preserving, at mostconcurrencycases in flight, rejections propagate.evaluateis extracted into arunCasehelper and scheduled through the pool. Behavior of a single case (scoring, usage accounting, error handling) is unchanged.1(serial), so existing callers see identical behavior. Models are still swept one at a time, keeping per-model rate limits predictable.concurrencyis validated as a positive integer.types.tscomment and the README row no longer say "not yet honored".Tests
Coverage asserts: serial by default, at most
concurrencycases in flight, results stay in case order under out-of-order completion, identical scoring vs serial, and rejection of0/-1/1.5. These evaluate-level tests are the behavior contract regardless of the pool implementation.pnpm typecheck && pnpm test: 75 passing.History
The first commit used a hand-rolled
mapConcurrentutil; the second swaps it forp-mapper review feedback.Note
This touches the same case loop as #7 (task error capture) — whichever merges first, the other rebases trivially; I'm happy to do that.
🤖 Generated with Claude Code
https://claude.ai/code/session_015XMPpi4PX2bWwAoMLaZZ4k