python -m laminar.eval runs standalone checkpoint evaluation over resident
rollout replicas without instantiating trainer, optimizer, or Relay actors.
laminar.eval is designed for efficient multi-checkpoint concurrent evaluation:
- Long-Tail Bubble Mitigation:
- Concurrent Replica Subsets: evaluate multiple checkpoints—whether across consecutive steps of a single training run or across different experiments—simultaneously on disjoint replica subsets (or across attached workers) with exact-version sticky routing (
ValidationRequestRouter). - Cross-Checkpoint Repack: consolidate tail-stage sessions onto fewer replicas (
validation.repack) when another checkpoint is waiting, immediately releasing drained replicas from the initial pool to load and evaluate the next queued checkpoint while the previous tail finishes, and recombining finished subsets once both complete.
- Concurrent Replica Subsets: evaluate multiple checkpoints—whether across consecutive steps of a single training run or across different experiments—simultaneously on disjoint replica subsets (or across attached workers) with exact-version sticky routing (
- Resident Replicas & In-Place Reload:
- Direct HF Initialization: load Hugging Face checkpoints (or trainer
global_step_*directories) directly into resident rollout replicas without allocating trainer, optimizer, orRelayresources. - In-Place Weight Reload: switch checkpoints in place via
LLMServerController.load_hf_checkpointwithout restarting Ray actors or inference engines. - Fault-Tolerant Replica Recovery: automatically fence, restart, and reload failed rollout replicas at their exact assigned checkpoint version while preserving already generated tokens for interrupted turns.
- Direct HF Initialization: load Hugging Face checkpoints (or trainer
- Unified Persistent Queue Service:
- Single- or Multi-Run Companion Evaluation: watch one or more active training run directories (
validation.queue.watch_runsorvalidation.queue.watch_dir) to auto-discover completedglobal_step_*checkpoints, skip already evaluated checkpoints, and mirror finishedversion_*.jsonresults back into each originating run'svalidation/directory. - On-Demand Submission: pre-enqueue checkpoints at startup (
validation.checkpoints), or submit additional checkpoints on the fly via Python Client (EvaluationQueueClient) or CLI—for example, to evaluate a previously skipped step or compare checkpoints from another run on the same resident service. - Elastic Worker Scaling: attach or drain additional independent GPU worker jobs (
validation.queue.endpoint) on the fly—for example, temporarily adding idle or spot GPU pools to clear a backlog of queued checkpoints.
- Single- or Multi-Run Companion Evaluation: watch one or more active training run directories (
flowchart LR
CLI["Python Client / CLI / Watcher<br/>EvaluationQueueClient / --submit / watch_runs"] -->|"Enqueue"| Queue["EvaluationQueue<br/>HTTP coordinator (queue.json)"]
Queue <-->|"Claim / Release / Finish"| Coord["Worker Coordinator<br/>(laminar.eval)"]
Coord -->|"Batch dispatch"| Adapter["AgentLoopManager<br/>(e.g. Uni-Agent)"]
Adapter <-->|"Session turns"| Router["ValidationRequestRouter<br/>Exact-version sticky routing"]
Router <-->|"Group 1 (version k)"| R1["Rollout Replicas"]
Router <-->|"Group 2 (version k+1)"| R2["Rollout Replicas"]
Coord -.->|"In-place HF reload & Repack"| Router
Coord -.->|"load_hf_checkpoint"| R1
Coord -.->|"load_hf_checkpoint"| R2
Coord -->|"Persist & mirror"| Results["Result Store<br/>version_000001.json ..."]
-
Task Admission (
EvaluationQueue,CheckpointRunWatcher&CheckpointDirectoryWatcher):- Checkpoints are admitted into a durable HTTP queue (
<result_dir>/queue/queue.json) fromvalidation.checkpointsat startup, from watched training directories (validation.queue.watch_runs/validation.queue.watch_dir), or dynamically via Python Client / CLI. - When
validation.queue.watch_runsis configured,CheckpointRunWatcherscans one or more training run roots for committedglobal_step_*HF exports (Megatronactor/model/huggingfaceor FSDPactor/huggingface), syncs bootstrap model/tokenizer metadata (backing up original export metadata under.megatron_export_meta/), skips checkpoints already queued or recorded in<run_dir>/validation/(orcompleted_versions/), and mirrors completed results back into each run'svalidation/directory.
- Checkpoints are admitted into a durable HTTP queue (
-
Exact-Version Routing (
ValidationRequestRouter):- Each worker initializes its replica pool on its first claimed checkpoint, assigns monotonically increasing evaluation
versionnumbers (1, 2, ...) to claimed tasks, and pins all session turns of each checkpoint to its exactweight_version.
- Each worker initializes its replica pool on its first claimed checkpoint, assigns monotonically increasing evaluation
-
Batched Rollout, Long-Tail Repack & Replica Recovery:
- Prompts are dispatched in waves of
validation.batch_size. - Once the final batch of a checkpoint is in flight across
$\ge 2$ replicas and another checkpoint is waiting in the queue,plan_validation_repackperiodically migrates active session routes from lightly loaded source replicas (kv_cache_usage <= source_max_kv_cache_usage) to destination replicas of the same version (kv_cache_usage <= destination_max_kv_cache_usage), aborting and resuming in-flight turns from already generated tokens. - Drained source replicas are released via
/release-replicasand immediately claim and reload the next queued checkpoint while the remaining replica subset finishes the old checkpoint's tail; finished subsets from the same original group are automatically recombined when idle. - If a rollout replica crashes during reload or rollout,
recover_dead_serverfences the replica inValidationRequestRouter, restarts it onto its assigned checkpoint and exact version, and resumes interrupted turns from their generated token prefixes.
- Prompts are dispatched in waves of
-
In-Place Reload & Result Finalization:
- When a replica group (or repacked subset) claims its next checkpoint,
ValidationRequestRouterfences those replicas from routing whileload_hf_checkpointreloads the new Hugging Face weights in place. - Completed prompt trajectories and rewards are aggregated, verified, and atomically persisted to
<result_dir>/version_<version:06d>.json(and mirrored to<run_dir>/validation/whenwatch_runsorsource.result_diris set) before acknowledging/finishto the queue.
- When a replica group (or repacked subset) claims its next checkpoint,
Refer to src/laminar/eval/config/validation_base.yaml for all validation.*, rollout_router.*, and default actor_rollout_ref.* configuration options.
python -m laminar.eval starts the persistent HTTP queue service (writing its URL to <result_dir>/queue/endpoint.txt) and runs worker control in the same driver, so a loopback endpoint remains local. Inference replicas use the Ray cluster's rollout.nnodes × rollout.n_gpus_per_node GPUs. Embedded workers receive a fresh submission identity unless validation.queue.worker_id is supplied:
# Companion mode watching one or more training runs (or use validation.queue.watch_dir for a single checkpoint dir)
python -m laminar.eval \
actor_rollout_ref.model.path=/shared/models/Base-Model \
validation.data_path=/shared/data/eval.parquet \
validation.result_dir=/shared/outputs/eval-service \
'validation.persistent_roots=[/shared/outputs]' \
'validation.queue.watch_runs=[/shared/outputs/swe-run-001,/shared/outputs/swe-run-002]' \
validation.queue.server_host=0.0.0.0 \
validation.queue.server_port=9000 \
actor_rollout_ref.rollout.nnodes=1 \
actor_rollout_ref.rollout.n_gpus_per_node=8 \
actor_rollout_ref.rollout.tensor_model_parallel_size=4 \
actor_rollout_ref.rollout.agent.agent_loop_manager_class=uni_agent.framework.entry.AgentFrameworkRolloutAdapter- Multi-run / single-run companion watching:
validation.queue.watch_runs=[/path/to/run_a,/path/to/run_b]: watches multiple training run roots, syncs bootstrap model/tokenizer metadata onto newglobal_step_*HF exports, optionally evaluates the base model once (validation.queue.watch_include_base=true), and mirrors each finished result back to<run_dir>/validation/version_*.json.validation.queue.watch_dir=/path/to/checkpoints: watches a single checkpoint directory directly (pollinglatest_checkpointed_iteration.txt).
- Offline / on-demand mode: omit
watch_runs/watch_dirand optionally pre-enqueue initial checkpoints via'validation.checkpoints=[/shared/checkpoints/global_step_400]'. - Elastic multi-worker scaling (optional): to attach additional independent GPU worker jobs (e.g., across separate Ray jobs or elastic spot pools) to the running queue, launch
python -m laminar.evalwithvalidation.queue.endpoint=http://<service-host>:9000, a uniquevalidation.queue.worker_id, and a freshvalidation.result_dir(or setvalidation.queue.coordinator_only=trueon the primary process if it should run on a CPU-only node without local GPUs).
The Python Client (EvaluationQueueClient, recommended) and CLI (python -m laminar.eval) map 1-to-1 and share the same endpoint resolution order (resolve_queue_endpoint):
- Explicit
endpoint(EvaluationQueueClient(endpoint=...)or--endpoint http://<host>:<port>) endpoint.txtinsidestate_diror<result_dir>/queue/endpoint.txt(whenserver_host=0.0.0.0,endpoint.txtrecordshttp://127.0.0.1:<port>for same-host clients; passendpointexplicitly from remote hosts, or setvalidation.queue.server_host=<service-ip>soendpoint.txtrecords the routable IP)- Default
http://127.0.0.1:9000
from laminar.eval import EvaluationQueueClient
# Connect via result_dir (or state_dir=..., endpoint="http://127.0.0.1:9000", timeout=30.0)
client = EvaluationQueueClient(result_dir="/shared/outputs/eval-run-001")
# Submit one or more checkpoints (accepts global_step_* or Hugging Face model dirs)
tasks = client.submit(
"/shared/checkpoints/global_step_440",
"/shared/checkpoints/global_step_480",
# Optional: source={...}, resume_results=[...], resume_protocol={...}
)
# Query full queue state or a single task_id
queue_state = client.status()
task_state = client.status(tasks[0]["task_id"])
# Drain the entire queue, or drain a single worker
client.drain()
client.drain(worker="worker-01")
# Requeue a finished task with audited repair evidence
client.requeue(
tasks[0]["task_id"],
previous_sha256="<result_sha256>",
review={"verdict": "FAIL", "artifact": "/shared/outputs/audit.json", "sha256": "..."},
# Optional: resume_results=[...], resume_protocol={...}
)# Submit one or more checkpoints (--source, --resume-results, --resume-protocol also supported)
python -m laminar.eval --result-dir /shared/outputs/eval-run-001 \
--submit /shared/checkpoints/global_step_440 /shared/checkpoints/global_step_480
# Query full queue state or a single task_id
python -m laminar.eval --result-dir /shared/outputs/eval-run-001 --status
python -m laminar.eval --result-dir /shared/outputs/eval-run-001 --status <task_id>
# Drain the entire queue, or drain a single worker
python -m laminar.eval --result-dir /shared/outputs/eval-run-001 --drain
python -m laminar.eval --result-dir /shared/outputs/eval-run-001 --drain --worker worker-01
# Requeue a finished task with audited repair evidence
python -m laminar.eval --result-dir /shared/outputs/eval-run-001 \
--requeue <task_id> \
--previous-sha256 <result_sha256> \
--review '{"verdict":"FAIL","artifact":"/shared/outputs/audit.json","sha256":"..."}'All evaluation artifacts are written under validation.result_dir (which must reside under validation.persistent_roots):
<result_dir>/version_000001.json,version_000002.json, ...: Per-checkpoint evaluation records andval-core/*/val-aux/*metrics (whenwatch_runsorsource.result_diris used, each completed record is also mirrored into the originating run's<run_dir>/validation/version_*.json); refer to_run_checkpoints/_summarize_scores,mirror_run_validation_result, andsummarize_evaluation/reward_evidencefor the schema and scoring validity rules.<result_dir>/queue/queue.json&endpoint.txt: Durable queue state, task ownership, and active HTTP endpoint; refer toEvaluationQueue.<result_dir>/efficiency/efficiency_<timestamp_ns>.json: Periodic non-destructive runtime efficiency snapshots; refer to_EfficiencySnapshots.capture.