Skip to main content

core.trainers.ebft.async_rollout

core.trainers.ebft.async_rollout

EBFT rollouts in async GRPO’s rollout process.

EBFT’s reward needs the feature network’s hidden states, which this CUDA-free process cannot compute, so samples leave with their advantage pending (trainer_scored) and carry what the trainer’s EBFTScorer needs: each rollout’s feature sequence and its group’s reference. Only the first assistant turn is trained; with remaining_turns the later assistant turns are generated as reward context only.

Classes

Name Description
EBFTRolloutLoop Generates EBFT rollouts and ships their feature sequences to the trainer.

EBFTRolloutLoop

core.trainers.ebft.async_rollout.EBFTRolloutLoop(
    adaptive_max_tokens=True,
    gt_length_multiplier=1.5,
    generation_kwargs=None,
    **kwargs,
)

Generates EBFT rollouts and ships their feature sequences to the trainer.

Parameters

Name Type Description Default
adaptive_max_tokens bool Size each prompt’s completions from its ground truth. True
gt_length_multiplier float Ground-truth tokens times this is the adaptive budget. 1.5
generation_kwargs dict[str, Any] | None Extra /v1/completions sampling parameters, e.g. stop_token_ids. None

Functions

Name Description
adaptive_max_tokens The ebft_adaptive_max_tokens budget for a prompt with ground_truth.
reference_ids Token IDs of the reference answer and where its pooled part starts.

adaptive_max_tokens

core.trainers.ebft.async_rollout.adaptive_max_tokens(
    tokenizer,
    ground_truth,
    max_tokens,
    multiplier,
)

The ebft_adaptive_max_tokens budget for a prompt with ground_truth.

reference_ids

core.trainers.ebft.async_rollout.reference_ids(
    tokenizer,
    prompt,
    ground_truth,
    remaining_turns=None,
    **template_kwargs,
)

Token IDs of the reference answer and where its pooled part starts.

Tokenized from text exactly as EBFTMixin._feature_matching_reward does.