Skip to content

(1/2) refactor(rollout): drop --generate-multi-samples and its per-turn sample semantics - #1916

Merged
guapisolo merged 4 commits into
mainfrom
refactor/remove-generate-multi-samples
Jul 29, 2026
Merged

(1/2) refactor(rollout): drop --generate-multi-samples and its per-turn sample semantics#1916
guapisolo merged 4 commits into
mainfrom
refactor/remove-generate-multi-samples

Conversation

@guapisolo

@guapisolo guapisolo commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Remove --generate-multi-samples without narrowing the generate output contract.

Motivation

The flag made every turn a separate full-context sample by skipping the TITO merge. Sample boundaries belong to trajectory topology, not a CLI switch; treating turns as siblings gives them one group_index and pollutes group baselines.

Removing the flag does not make GenerateFnOutput.samples list-only. The contract remains Sample | list[Sample]:

  • Current built-in linear generators return one merged scalar sample, while custom generators may return lists for multi-agent or tree trajectories.
  • TODO: add tree like trajectory support, returning list[Sample].

Before / After

  • Before / After: Flag-selected output shape → scalar output from built-in linear generators.
  • What moved where: Both built-in generators lose flag-controlled branches, while dynamic filters continue to accept scalar or list elements under the existing union contract.
  • The deprecated examples/experimental/swe-agent-v2/README.md remains unchanged.

Behavior Preservation

  • How we know: Generate-hub tests compare merged trajectory values for both built-in generators.
  • Generate-hub tests assert scalar aborted paths.
  • Train/eval integration tests cover scalar output from both built-in generators.
  • Agent metadata integration covers the scalar custom reward path.
  • Multi-sample integration covers custom list[Sample] output.

Verification

  • Existing test suite: test_multi_turn.py passed 24 tests with 7 expected skips.
  • Rollout integration: Train/eval coverage passed 4 tests.
  • Metadata integration: The agent metadata test passed.
  • Multi-sample integration: The custom list-output test passed.
  • Pre-commit: All hooks passed on the four corrected files.

Review Focus

  • Scrutinize the built-in linear generators for removal of only the flag-controlled per-turn branches.
  • Confirm GenerateFnOutput.samples remains Sample | list[Sample] even though the built-in linear generators return scalar samples.
  • Confirm this diff contains no /samples endpoint, codec, or HTTP transport change.

…ple semantics

The flag made every turn a separate full-context sample by skipping the TITO merge. That is incorrect: sample boundaries belong to the trajectory, not a CLI switch, and per-turn siblings share one group_index and pollute group baselines.

Linear multi-turn generation now accumulates one scalar sample. Agentic generation always merges the recorded linear session and returns list[Sample], including aborted paths, so a batch does not mix scalar and list shapes.

Consequently, custom reward models on the agentic path receive list[Sample], dynamic filters flatten nested groups, and agentic use with group RM, partial rollout, or recompute-logprobs-via-prefill remains unsupported.
…ample]]

A dynamic-filter group mixes scalar and list elements (agentic generate
returns list[Sample] per call), which is exactly why _flatten_samples
exists; the old list[Sample] annotation misdocumented that contract.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

Comment thread docs/user-guide/rollout-endpoints.md Outdated
- `compute_prompt_ids_from_sample` and `compute_request_payload` from
`miles/rollout/generate_utils/generate_endpoint_utils.py` build `/generate` requests.
- For multi-sample outputs, set `--generate-multi-samples` and return a list.
- Returning a `list[Sample]` from a generate function is supported natively; no flag is needed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning a Sample or list[Sample].

No need to mention "flag is needed or supported natively"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in eae3bdf: the docs now state that GenerateFnOutput.samples accepts a Sample or list[Sample], without tying that contract to a flag or “native support.”

Comment thread docs/user-guide/rollout-endpoints.md Outdated

<Warning>

**Agentic output is a `list[Sample]`.** `agentic_tool_call.generate` always returns a list

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not always actually.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in eae3bdf: I removed the list-only agentic warning. agentic_tool_call.generate now returns the merged scalar Sample on success and aborted paths, while GenerateFnOutput.samples continues to support both shapes for custom generators.

The swe-agent-v2 example is planned for deprecation, so this rollout refactor should not update its guidance. Restore the README to the main-branch version and keep the PR focused on supported rollout paths.
Removing --generate-multi-samples eliminates flag-controlled per-turn samples; it does not narrow GenerateFnOutput.samples. Return the merged linear agentic trajectory as a scalar Sample while preserving Sample | list[Sample] for custom generators.
guapisolo added a commit that referenced this pull request Jul 29, 2026
…nal overlay

Select the samples-wire allowlist when each tracer is created. V1 direct constructions retain the base fields and the exact {max_seq_len: ...} request body; v2 adds agent metadata to the collection body and decodes the reward field returned by tree assembly.

agentic_tool_call keeps the #1916 scalar contract for v1 and returns list[Sample] only for v2 multi-leaf output. V2 applies agent metadata on the server, while v1 retains the driver overlays. Collection failures continue to propagate, empty replies return an ABORTED value with the version-appropriate shape, and unsupported v2 combinations with --group-rm, --partial-rollout, or --recompute-logprobs-via-prefill fail before creating a session.

Pins cover the v1 payload, version-based field selection, the v2 metadata and reward channel, v2 success and empty shapes, failure propagation, and unsupported consumers. The rollout endpoint guide documents the conditional output contract.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@Shi-Dong Shi-Dong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@guapisolo
guapisolo merged commit b05a4f2 into main Jul 29, 2026
40 checks passed
@guapisolo
guapisolo deleted the refactor/remove-generate-multi-samples branch July 29, 2026 18:44
guapisolo added a commit that referenced this pull request Jul 30, 2026
…nal overlay

Select the samples-wire allowlist when each tracer is created. V1 direct constructions retain the base fields and the exact {max_seq_len: ...} request body; v2 adds agent metadata to the collection body and decodes the reward field returned by tree assembly.

agentic_tool_call keeps the #1916 scalar contract for v1 and returns list[Sample] only for v2 multi-leaf output. V2 applies agent metadata on the server, while v1 retains the driver overlays. Collection failures continue to propagate, empty replies return an ABORTED value with the version-appropriate shape, and unsupported v2 combinations with --group-rm, --partial-rollout, or --recompute-logprobs-via-prefill fail before creating a session.

Pins cover the v1 payload, version-based field selection, the v2 metadata and reward channel, v2 success and empty shapes, failure propagation, and unsupported consumers. The rollout endpoint guide documents the conditional output contract.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
guapisolo added a commit that referenced this pull request Jul 31, 2026
…nal overlay

Select the samples-wire allowlist when each tracer is created. V1 direct constructions retain the base fields and the exact {max_seq_len: ...} request body; v2 adds agent metadata to the collection body and decodes the reward field returned by tree assembly.

agentic_tool_call keeps the #1916 scalar contract for v1 and returns list[Sample] only for v2 multi-leaf output. V2 applies agent metadata on the server, while v1 retains the driver overlays. Collection failures continue to propagate, empty replies return an ABORTED value with the version-appropriate shape, and unsupported v2 combinations with --group-rm, --partial-rollout, or --recompute-logprobs-via-prefill fail before creating a session.

Pins cover the v1 payload, version-based field selection, the v2 metadata and reward channel, v2 success and empty shapes, failure propagation, and unsupported consumers. The rollout endpoint guide documents the conditional output contract.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
guapisolo added a commit that referenced this pull request Jul 31, 2026
…nal overlay

Select the samples-wire allowlist when each tracer is created. V1 direct constructions retain the base fields and the exact {max_seq_len: ...} request body; v2 adds agent metadata to the collection body and decodes the reward field returned by tree assembly.

agentic_tool_call keeps the #1916 scalar contract for v1 and returns list[Sample] only for v2 multi-leaf output. V2 applies agent metadata on the server, while v1 retains the driver overlays. Collection failures continue to propagate, empty replies return an ABORTED value with the version-appropriate shape, and unsupported v2 combinations with --group-rm, --partial-rollout, or --recompute-logprobs-via-prefill fail before creating a session.

Pins cover the v1 payload, version-based field selection, the v2 metadata and reward channel, v2 success and empty shapes, failure propagation, and unsupported consumers. The rollout endpoint guide documents the conditional output contract.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
guapisolo added a commit that referenced this pull request Aug 1, 2026
…nal overlay

Select the samples-wire allowlist when each tracer is created. V1 direct constructions retain the base fields and the exact {max_seq_len: ...} request body; v2 adds agent metadata to the collection body and decodes the reward field returned by tree assembly.

agentic_tool_call keeps the #1916 scalar contract for v1 and returns list[Sample] only for v2 multi-leaf output. V2 applies agent metadata on the server, while v1 retains the driver overlays. Collection failures continue to propagate, empty replies return an ABORTED value with the version-appropriate shape, and unsupported v2 combinations with --group-rm, --partial-rollout, or --recompute-logprobs-via-prefill fail before creating a session.

Pins cover the v1 payload, version-based field selection, the v2 metadata and reward channel, v2 success and empty shapes, failure propagation, and unsupported consumers. The rollout endpoint guide documents the conditional output contract.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
guapisolo added a commit that referenced this pull request Aug 1, 2026
…nal overlay

Select the samples-wire allowlist when each tracer is created. V1 direct constructions retain the base fields and the exact {max_seq_len: ...} request body; v2 adds agent metadata to the collection body and decodes the reward field returned by tree assembly.

agentic_tool_call keeps the #1916 scalar contract for v1 and returns list[Sample] only for v2 multi-leaf output. V2 applies agent metadata on the server, while v1 retains the driver overlays. Collection failures continue to propagate, empty replies return an ABORTED value with the version-appropriate shape, and unsupported v2 combinations with --group-rm, --partial-rollout, or --recompute-logprobs-via-prefill fail before creating a session.

Pins cover the v1 payload, version-based field selection, the v2 metadata and reward channel, v2 success and empty shapes, failure propagation, and unsupported consumers. The rollout endpoint guide documents the conditional output contract.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
guapisolo added a commit that referenced this pull request Aug 1, 2026
…nal overlay

Select the samples-wire allowlist when each tracer is created. V1 direct constructions retain the base fields and the exact {max_seq_len: ...} request body; v2 adds agent metadata to the collection body and decodes the reward field returned by tree assembly.

agentic_tool_call keeps the #1916 scalar contract for v1 and returns list[Sample] only for v2 multi-leaf output. V2 applies agent metadata on the server, while v1 retains the driver overlays. Collection failures continue to propagate, empty replies return an ABORTED value with the version-appropriate shape, and unsupported v2 combinations with --group-rm, --partial-rollout, or --recompute-logprobs-via-prefill fail before creating a session.

Pins cover the v1 payload, version-based field selection, the v2 metadata and reward channel, v2 success and empty shapes, failure propagation, and unsupported consumers. The rollout endpoint guide documents the conditional output contract.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
guapisolo added a commit that referenced this pull request Aug 1, 2026
…nal overlay

Select the samples-wire allowlist when each tracer is created. V1 direct constructions retain the base fields and the exact {max_seq_len: ...} request body; v2 adds agent metadata to the collection body and decodes the reward field returned by tree assembly.

agentic_tool_call keeps the #1916 scalar contract for v1 and returns list[Sample] only for v2 multi-leaf output. V2 applies agent metadata on the server, while v1 retains the driver overlays. Collection failures continue to propagate, empty replies return an ABORTED value with the version-appropriate shape, and unsupported v2 combinations with --group-rm, --partial-rollout, or --recompute-logprobs-via-prefill fail before creating a session.

Pins cover the v1 payload, version-based field selection, the v2 metadata and reward channel, v2 success and empty shapes, failure propagation, and unsupported consumers. The rollout endpoint guide documents the conditional output contract.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants