Repository navigation
Description
Problem
In Agent Lightning v1.0, the rollout-to-training path currently goes through:
raw rollout events
-> triplet-formatted event view
-> CompletedRollout.triplets
-> RolloutAdapter
-> VERL training rows
During this conversion, a completed rollout may lose all trainable model requests for several reasons:
- a
model_requesthasstatus == "error"; - a request has
http_status >= 400; response_token_idsis empty;- the resulting rows contain zero trainable response tokens.
The current implementation correctly skips these requests or rows. However, the reason for each skipped request is not preserved when _build_completed_rollout creates CompletedRollout.triplets.
As a result, the existing adapter metrics can report how many rollouts or rows survived, but cannot explain why a particular rollout produced no trainable triplets.
When every row in a batch is excluded, the final error is currently:
get_train_data_batch emitted zero training rows.
The CompletedRollout still contains the raw and triplet-formatted event views, so the information required for diagnosis exists, but users must manually inspect the events and reconstruct the conversion decisions.
Relevant code:
AglRolloutManagerBase._build_completed_rolloutRolloutAdapter.get_train_data_batchformat=tripletevent projection
Related but distinct work:
- [Feature] Add data validation steps to
trainer.devfor early error detection #385 validates dataset/PyArrow conversion, not rollout-event conversion. - Triplet view collapses requests without valid prompt token IDs #572 / fix(server): preserve requests without valid prompt token IDs #573 fixed prompt-token deduplication behavior.
- This proposal does not change either policy.
Proposed thin slice
Add a small structured diagnostic summary to the existing rollout-to-triplet conversion path.
For each completed rollout, collect counts such as:
raw_model_request_count
projected_model_request_count
emitted_triplet_count
skipped_status_error_count
skipped_http_error_count
skipped_empty_response_count
reward_event_count
has_numeric_final_reward
The skip counters for projected model requests should be mutually exclusive, using the same precedence as the existing filtering behavior:
status error
-> HTTP error
-> empty response token IDs
-> emitted triplet
This keeps the following invariant easy to test:
projected_model_request_count
== emitted_triplet_count
+ skipped_status_error_count
+ skipped_http_error_count
+ skipped_empty_response_count
Keeping both raw_model_request_count and projected_model_request_count would also make prompt-based projection or deduplication visible without changing its behavior.
The initial implementation could:
- expose aggregate counts through the existing training metrics;
- include aggregate reason counts in the zero-training-row exception;
- optionally print a capped list of affected rollout IDs.
For example:
get_train_data_batch emitted zero training rows:
rollouts=8,
raw_model_requests=32,
projected_model_requests=24,
emitted_triplets=0,
skipped_status_error=8,
skipped_http_error=4,
skipped_empty_response=12,
rollouts_without_triplets=8.
No prompts, responses, token arrays, images, or other potentially large or sensitive event payloads need to be logged.
I am intentionally proposing a focused conversion diagnostic rather than a generic trajectory-validation framework. A private typed helper, or a small diagnostic field on CompletedRollout, should be sufficient.
Why this is useful
This would distinguish failures at different boundaries:
agent produced no model requests
vs.
model requests were recorded but rejected
vs.
triplets were emitted but no trainable rows remained
It would also make a missing or invalid reward distinguishable from a valid reward value of 0, without changing the existing reward-fill behavior.
The result should reduce the amount of manual event inspection required when an agent finishes successfully but VERL receives an empty batch.
Non-goals
- Do not reject events when they are written to the Store.
- Do not enforce schemas for arbitrary user-defined event types.
- Do not change the current request-filtering behavior.
- Do not change prompt-token deduplication introduced by fix(server): preserve requests without valid prompt token IDs #573.
- Do not change reward-fill semantics.
- Do not auto-repair malformed event payloads.
- Do not introduce a trajectory quality score or rule engine.
- Do not add tool/action-observation or multi-agent lineage validation in this initial PR.
- Do not introduce a new public API endpoint.
Malformed token-ID schema validation could be discussed separately after the diagnostic shape and ownership are agreed upon.
Acceptance criteria
- Valid rollouts produce exactly the same triplets and VERL training rows as before.
- Existing filtering and deduplication behavior remains unchanged.
- Error-status, HTTP-error, and empty-response fixtures produce stable, machine-readable reason counts.
- Each projected model request is classified at most once.
- A valid reward value of
0is distinguishable from a missing or non-numeric reward. - A zero-row batch raises an actionable error containing aggregate reason counts.
- Mixed valid and invalid batches expose aggregate metrics without logging every event.
- Existing metric names and behavior remain backward compatible.
- Diagnostics do not include raw prompts, responses, images, or token arrays.
- CPU-only tests cover both
_build_completed_rolloutandRolloutAdapter.get_train_data_batch.
Design question
Would maintainers prefer the diagnostic summary to:
- live on
CompletedRollout, close to where the filtering decisions are made; or - remain private to the VERL manager/adapter and only surface through metrics and error messages?
I would prefer the smallest API surface that fits the current v1 design. If this direction is acceptable, I would be happy to implement the focused helper, CPU-only regression tests, and a short documentation update.
Activity
hzy46 commentedon Sep 14, 2026
Thank you for this suggestion. However, agent lightning v1.0 is deliberately kept simple. The best way might be to add some log in server proxy.