Skip to content

fix(reassessment): stay serial on low-core hosts; release 0.2.7.post1#113

Merged
marota merged 1 commit into
ainetus:mainfrom
marota:claude/expert-op4grid-refactor-bqy6jm
Jul 3, 2026
Merged

fix(reassessment): stay serial on low-core hosts; release 0.2.7.post1#113
marota merged 1 commit into
ainetus:mainfrom
marota:claude/expert-op4grid-refactor-bqy6jm

Conversation

@marota

@marota marota commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

The parallel per-action reassessment (0.2.6) clones the whole network per worker (save/load_from_binary_buffer + SimulationEnvironment + observation build) — a fixed overhead the serial path never pays, only amortized above ~3-4 usable cores. On a 2-vCPU host (e.g. a small HuggingFace Space) the two clones + GIL contention on the Python-side observation build make the parallel path SLOWER than serial (observed ~42 s vs ~9 s on a many-core Mac for the same 15-action pan-European case).

Parallel reassessment is now gated behind
min(10, cores, n_actions) >= EXPERT_OP4GRID_MIN_PARALLEL_REASSESS_WORKERS (default 4, floored at 2, env-tunable): 2-vCPU deployments fall back to the faster serial path, >=4-core hosts keep the speed-up. Behaviour-preserving — only which path runs changes, not the per-action results.

Adds tests/test_reassessment_parallel_gate.py (16 tests) for the decision + env override. Bumps version to 0.2.7.post1 (CHANGELOG entry).

Claude-Session: https://claude.ai/code/session_01LGzwaP2SnQCbLKo4ZNuwSg

The parallel per-action reassessment (0.2.6) clones the whole network per
worker (save/load_from_binary_buffer + SimulationEnvironment + observation
build) — a fixed overhead the serial path never pays, only amortized above
~3-4 usable cores. On a 2-vCPU host (e.g. a small HuggingFace Space) the two
clones + GIL contention on the Python-side observation build make the parallel
path SLOWER than serial (observed ~42 s vs ~9 s on a many-core Mac for the same
15-action pan-European case).

Parallel reassessment is now gated behind
`min(10, cores, n_actions) >= EXPERT_OP4GRID_MIN_PARALLEL_REASSESS_WORKERS`
(default 4, floored at 2, env-tunable): 2-vCPU deployments fall back to the
faster serial path, >=4-core hosts keep the speed-up. Behaviour-preserving —
only which path runs changes, not the per-action results.

Adds tests/test_reassessment_parallel_gate.py (16 tests) for the decision +
env override. Bumps version to 0.2.7.post1 (CHANGELOG entry).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LGzwaP2SnQCbLKo4ZNuwSg
Signed-off-by: Antoine Marot <amarot91@gmail.com>
@marota marota merged commit a67a1fa into ainetus:main Jul 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant