47 model fiyatı
  1. Ana sayfa
  2. Sürümler
  3. TRL
  4. 1.18.0

TRL 1.18.0 sürüm notları

TRL 1.18.0 sürümünün yayın tarihi 13 Kasım 2026. En güncel sürüm 1.19.0.

v1.18.0 · · 52 değişiklik maddesiKırıcı

Bu sürümün notları kırıcı değişikliklerden bahsediyor.

Orijinal sürüm notları

Features

[!WARNING] The submodules of trl.experimental.async_grpo are gone. from trl.experimental.async_grpo.async_grpo_config import AsyncGRPOConfig, and imports from async_rollout_worker, packing, vllm_client or weight_transfer in that package, no longer work. Import the trainer from trl, the rollout loop from trl.trainer.async_grpo_trainer, and the vLLM client from trl.generation.async_vllm_client (renamed AsyncVLLMClient). from trl.experimental.async_grpo import AsyncGRPOConfig, AsyncGRPOTrainer still works, with a FutureWarning, until v2.0.0.

:mortar_board: AsyncGRPOTrainer is now a stable trainer

AsyncGRPOTrainer runs GRPO with generation decoupled from training. A rollout worker in a background process streams completions from a vLLM server, scores them and queues them, while the training loop pulls from the queue and updates the model. Generation and gradient updates overlap instead of alternating, and the trainer sends its new weights to the server over NCCL every weight_sync_steps steps.

In v1.17 it lived in trl.experimental.async_grpo: seven files, three ways to batch and bound generation, two constructor arguments for swapping out internals, and metric names that didn't match GRPO's. This cycle cleaned that up in about 40 PRs, tracked in https://github.com/huggingface/trl/issues/7841: config renames, one timeout instead of three, one batching mode, generation held to max_staleness, GRPO's metric names and init checks, a public rollout loop, and the two-file layout every stable trainer has. Then https://github.com/huggingface/trl/pull/8288 moved it to the top-level package.

# Before
from trl.experimental.async_grpo import AsyncGRPOConfig, AsyncGRPOTrainer

# Now
from trl import AsyncGRPOConfig, AsyncGRPOTrainer

The old path still works and emits a FutureWarning (removal in v2.0.0). The rollout loop extension point lives next to the trainer, from trl.trainer.async_grpo_trainer import AsyncRolloutLoop, Rollout, and isn't exported from trl. The OpenEnv / Harbor harness stays experimental, as HarnessAsyncGRPOTrainer in trl.experimental.async_grpo.openenv_harness. Logged metric names can still change between releases.

Quick start, from the docs. Install with pip install trl[vllm,kernels,math_verify], then start the vLLM server on GPU 0:

CUDA_VISIBLE_DEVICES=0 VLLM_SERVER_DEV_MODE=1 vllm serve Qwen/Qwen3.5-2B \
    --weight-transfer-config '{"backend": "nccl"}' \
    --logprobs-mode processed_logprobs \
    --api-server-count 8 \
    --max-model-len 4096

Then train on GPU 1 with CUDA_VISIBLE_DEVICES=1 python train_async_grpo.py:

# train_async_grpo.py
from datasets import load_dataset
from trl import AsyncGRPOTrainer
from trl.rewards import accuracy_reward

if __name__ == "__main__":  # the rollout worker is a spawned process that re-imports this script
    dataset = load_dataset("trl-lib/DeepMath-103K", split="train")

    trainer = AsyncGRPOTrainer(
        model="Qwen/Qwen3.5-2B",
        reward_funcs=accuracy_reward,
        train_dataset=dataset,
    )
    trainer.train()

This exact example runs end to end. It's a sanity check, not a speedup comparison:

Model / data / reward Qwen/Qwen3.5-2B, trl-lib/DeepMath-103K, accuracy_reward
Hardware 2x B200: vLLM on one GPU, the trainer on the other
Config default AsyncGRPOConfig: fp32 weights with bf16 autocast, 8 generations per prompt, up to 2048 completion tokens, token_budget read from --max-model-len 4096
Step time ~7 s/step, after ~5 min of warmup
Throughput ~7k trained tokens/s
Trainer vs vLLM log-prob gap 0.007 to 0.02

What the trainer covers, all documented on the trainer page:

:boom: What this changes for you. If you used the experimental AsyncGRPOTrainer in v1.17, the breaking changes all landed before the promotion, so they don't have to happen after it. AsyncDistillationTrainer (still experimental) got the same constructor removals, config renames, timeout merge, batching and staleness changes and metric conventions in the same PRs.

Constructor arguments:

Config:

v1.17 (experimental) v1.18
max_inflight_tasks (-1 = automatic) max_concurrent_rollouts, a fixed ceiling, 512 by default
heartbeat_stale_after_s rollout_worker_timeout (same meaning, same 300 s default)
request_timeout, weight_sync_timeout removed: vllm_server_timeout (default 1800 s, was 240 s) now covers server readiness, every request and every weight-sync call
queue_maxsize removed: generation is held to max_staleness, counted in tokens
fork_threshold_tokens removed: a multi-turn rollout always forks on re-tokenization drift, so no generated token loses its training signal
token_budget <= 0 (fixed-count batching) removed: the token-budget batcher is the only mode. Use None (read max_model_len from the server) or a positive int
repetition_penalty removed: the sampler's log-probs include it and the trainer's don't, which biases the importance ratio
remove_unused_columns=True (ignored) defaults to False, and True raises: every dataset column goes to the reward functions

Behavior to check after upgrading:

Metrics: where AsyncGRPO and GRPO log the same quantity, AsyncGRPO now mostly uses the GRPO name. The async-only metrics keep their namespaces (rollout/, sample/, batch/, perf/, tools/, env/), with one meaning per suffix: _count is a count over the logging window, _s a duration, _per_s a rate, _frac a fraction. Dashboards and scripts that read the old names need the new ones.

v1.17 (experimental) v1.18
rewards/<func> rewards/<func>/mean, plus rewards/<func>/group_std
reward_std reward_group_std (within-group, unlike GRPO's batch-wide reward_std)
ratio sampling/importance_sampling_ratio/{mean,min,max}
kl (k3 estimate against the sampler) removed. sampling/sampling_logp_difference/{mean,max} is GRPO's measure of the same gap, and kl stays free for a reference-model KL
frac_reward_zero_std frac_zero_std_groups (GRPO and RLOO keep frac_reward_zero_std)
reward_kept reward_trained
rollout/inflight, rollout/inflight_cap rollout/concurrency, rollout/concurrency_cap
rollout/kv_cache_usage rollout/vllm_kv_cache_usage_frac
sample/rollout_queue_size rollout/queue_size
rollout/generated_tok_s rollout/generated_tokens_per_s
perf/forwarded_tok_s_fwd_bwd, perf/forwarded_tok_s_wall_clock, perf/trained_tok_s_wall_clock perf/fwd_bwd_forwarded_tokens_per_s, perf/wall_clock_forwarded_tokens_per_s, perf/wall_clock_trained_tokens_per_s
perf/mfu_fwd_bwd, perf/mfu_wall_clock perf/fwd_bwd_mfu, perf/wall_clock_mfu
sample/dropped_stale_total, batch/dropped_oversize_total, rollout/vllm_retry_total, tools/<name>/call_total, tools/<name>/failure_total, tools/unknown_name_total the same names ending in _count
rollout/vllm_preemptions_total rollout/vllm_preemption_count
rollout/realign_frac removed, with fork_threshold_tokens

New: num_tokens, completions/{mean,min,max}_length, completions/{mean,min,max}_terminated_length, completions/clipped_ratio, reward_zero_std_groups (the mean reward of the dropped groups) and completions/duplicate_frac. Fixed: tools/call_frequency and tools/failure_frequency now count every rollout, as in GRPO, and rewards/<func>/mean counts once per scored rollout.

The PRs, by @AmineDiro, @qgallouedec and @lewtun unless noted:

Other

GRPO server mode now renormalizes over vLLM's candidate set. With top_p, min_p or structured outputs, vLLM's log-probs are normalized over the tokens left after filtering. Colocate mode already handled this. In server mode the trainer normalized over the whole vocabulary, so GRPO warned that the importance sampling ratio was biased, or refused structured outputs. A vLLM server (>= 0.28) started with --return-sampling-mask now returns the candidate set of each sampled token, VLLMClient.generate(return_sampling_mask=True) reads it, and GRPO turns it on when the server reports the flag. With Qwen2.5-0.5B-Instruct, top_k=10 and a vLLM 0.32 server, the ratio stays between 0.85 and 1.27 for structured outputs and top_p=0.9, where it was 1e-13 to 1e-31 for structured outputs without the candidate set. trl vllm-serve doesn't add the flag by default, since the server then rejects every request with top_k=0 or temperature=0. By @albertvillanova in https://github.com/huggingface/trl/pull/8235

UDPO loss for noisy preferences. DPOTrainer gets loss_type="udpo", the normalized Unbiased DPO loss from Unbiased Alignment for Large Language Models with Noisy Preferences. It corrects for preference labels flipped with probability ε, read from label_smoothing in [0.0, 0.5), and unlike "robust" it stays unbiased when ε is overestimated.

from trl import DPOConfig

training_args = DPOConfig(loss_type="udpo", label_smoothing=0.4)

By @cswjl in https://github.com/huggingface/trl/pull/8211

Privileged-context distillation in GOLD. The teacher sees per-example extra context while the student keeps its original prompt, and both score the same completion tokens. Turn it on with use_privileged_context=True, and set privileged_context_column and teacher_prompt_template as needed. It supports text, off-policy (lmbda=0) standard JSD distillation only. See the GOLD docs. By @eshwanthkartitr in https://github.com/huggingface/trl/pull/6437

MXFP4 and FP8 checkpoints load dequantized. With kernels installed, any trainer given openai/gpt-oss-20b by name refused to train: transformers rejects full fine-tuning of a quantized model, and PEFT finds nothing to adapt in the packed MXFP4 experts. Trainers now load MXFP4 and FP8 checkpoints dequantized. A quantization_config in model_init_kwargs still wins. FP8 needs transformers>=5.0.0, DeepSeek-V3/R1 still fail to dequantize upstream (huggingface/transformers#49873), and before transformers 5.23 MXFP4 experts come back bfloat16 whatever the dtype. By @qgallouedec in https://github.com/huggingface/trl/pull/8070

import trl no longer scans every installed package. It built a package-to-distribution map with importlib.metadata.packages_distributions(), which stats every file of every installed distribution without a top_level.txt (torch 2.14 ships none). The map is gone. Measured on a network filesystem, 8 alternating runs:

before after
import trl 13.1 s 0.08 s
from trl import SFTTrainer 40.7 s 27.4 s

The second row gains less because transformers still makes its own call (huggingface/transformers#49591). By @qgallouedec in https://github.com/huggingface/trl/pull/7947

More chat templates for tool calling and assistant-only loss. add_response_schema (so GRPOTrainer with tools) and assistant_only_loss=True in SFT now work on many more checkpoints. All by @albertvillanova:

trl <cmd> launches with torchrun. Arguments the script doesn't know go to torchrun (--nproc_per_node, --nnodes, ...), and DeepSpeed and FSDP are set through the training arguments (--deepspeed zero3.json, --fsdp), like for any Trainer. accelerate launch keeps working: until v2.0.0, trl still uses it, with a FutureWarning, for arguments only accelerate knows (--num_processes, --accelerate_config) and when an accelerate config default file exists. examples/accelerate_configs/ is replaced by examples/deepspeed_configs/*.json and examples/fsdp_configs/fsdp2.json. See the CLI docs. By @qgallouedec in https://github.com/huggingface/trl/pull/7180

padding_free=True works with max_length in SFT. SFT raised whenever padding_free=True met a max_length (including the default 1024) without packing. Truncation now happens during dataset preparation for padding-free too, so the guard only blocked a valid config. By @qgallouedec in https://github.com/huggingface/trl/pull/8077

Removals and requirement bumps

vLLM support follows the 5-month window: the minimum goes from 0.22.0 to 0.23.0, and 0.33.x is now supported, so the range is vllm>=0.23.0,<0.34.0. vLLM 0.33.0 requires torch 2.14.0, so pip install -U "trl[vllm]" pulls it.

Fixes

Several of these change what a run trains on. The first one needs action on models you already saved.

MoE models saved by SFTTrainer v1.7.0 to v1.17.1 compute router logits at every forward, inference included. SFT wrote output_router_logits=True and router_aux_loss_coef into the model config and saved them, so fine-tuned MoE models kept returning their router logits, and an overridden coef carried over to the next fine-tune. Like GRPO, RLOO, DPO and KTO, SFT now leaves the config alone. It keeps the config the model was loaded with, though, so a model saved by one of these versions keeps the flag even after another fine-tune. To reset it, set it back to False and save again:

model = AutoModelForCausalLM.from_pretrained("path/to/model")
model.config.output_router_logits = False  # model.config.text_config.output_router_logits for a VLM
model.save_pretrained("path/to/model")

By @qgallouedec in https://github.com/huggingface/trl/pull/8103

CISPO gradients were 5x too small by default. CISPO clips the importance weight itself, but an unset epsilon_high fell back to epsilon=0.2, so every on-policy weight was clipped to 0.2. With loss_type="cispo", an unset epsilon_high now defaults to 5.0, the value the docstring already recommended. On the repro, grad_norm goes from 0.0539 to 0.2693 and cispo_clip_ratio from 0.375 to 0. By @qgallouedec in https://github.com/huggingface/trl/pull/7917

Assistant-only loss trained tokens the generation prompt already ends with. Several training templates put the turn opener or the pre-filled thinking block inside {% generation %}, so SFT trained tokens the model never generates. The rendered text doesn't change, only the mask: Qwen3 (#8072), GLM-4-MoE (#8122), DeepSeek-R1/V3 and R1-Distill (#8060), Nemotron 3 (#8217), gpt-oss (#8219), Muse Glimmer (#8221), and the Qwen3.6 and Qwen3.8 revisions shipped since 2026-11-07, which bring their own markers (#8199, #8187). The DeepSeek-R1/V3 training template also dropped the reasoning of assistant turns from the target (#8061). All by @albertvillanova.

AsyncGRPO and AsyncDistillation reused prefix-cache KV computed by older weights. Each weight sync pauses vLLM without clearing its prefix cache, so a prefix shared by many prompts (system prompt, few-shot examples, tool schemas) kept the KV of the weights that first served it for the whole run. Rollout requests are now salted by model version. On a Qwen3.5-35B-A3B LoRA run with a ~2.4k-token shared prefix, mean train reward over steps 11-20 went from 0.726 to 0.781. By @AmineDiro in https://github.com/huggingface/trl/pull/8300

GKD divided its loss by the length of answers it threw away. On-policy and seq_kd steps counted num_items_in_batch on the dataset labels, then replaced them with generated completions. On the repro, num_items_in_batch goes from 172 to 16, the number of tokens the loss sums over. By @qgallouedec in https://github.com/huggingface/trl/pull/7925

One rejected token vetoed a whole VESPO sequence. With loss_type="vespo" and vllm_importance_sampling_mode="token_mask", a token outside the ratio bounds got a ratio of 0, whose clamped log collapsed the sequence weight to ~0, while the token itself kept its gradient. Rejected tokens are now dropped from both the sequence weight and the loss. By @yusufozdil in https://github.com/huggingface/trl/pull/8108

GRPO configurations that trained nothing without an error now raise:

Crashes and hangs:

The rest:

Clearer errors

AsyncGRPO checks at init what GRPO checks. All by @qgallouedec: an unsupported train_dataset type (#8204), image datasets, since the trainer trains on text only (#8208), no reward source at all (#8249), GRPO's tool requirements with tools or environment_factory (#8206), a response parser only when there are tools (#8242), the reward count, with a warning when every reward is None (#8205), and a passed PeftModel no longer crashes at the first step while prompt-learning adapters are refused (#8207).

The async trainers raise on a vLLM 4xx right away, with the server's message, instead of retrying a bad request about 90 times and failing with 400, message='Bad Request', by @AmineDiro in https://github.com/huggingface/trl/pull/8190. AsyncDistillation fails fast when a teacher has no room to score a sequence, instead of stalling on retried 400 Bad Requests, by @sergiopaniego in https://github.com/huggingface/trl/pull/8015.

Documentation

Examples told as stories. Rewrite the gpt-oss example around chess puzzles: on 1,000 test puzzles, gpt-oss-20b goes from 14.8% to 71.8% solved after a full fine-tune, and 69.9% back in MXFP4 (#8085), by @qgallouedec. Add an LFM2.5-8B-A1B research agent example with SFT and GRPO, where held-out exact match goes from 35.8% to 47.8% (#7754), by @qgallouedec. Start the Wordle (#7932) and Sudoku (#8097) examples from SFT models with shaped rewards, add examples/sft_agent_traces to fine-tune a small model on a coding agent's traces (#8222), use the released Open-MOPD experts in the MOPD example (#8014) and move it to its own folder (#8101), by @sergiopaniego. Pin the AsyncGRPO Harbor example to the OpenEnv 0.7.0 release (#8034) and use non-reentrant checkpointing in the Online DPO visual math example (#8268), by @albertvillanova.

CI

Flash Attention compatible tiny models. Make the tiny Llama-3, Llama-3.1, Llama-3.2, Mistral-0.1, Mistral-0.2, Qwen2-R1-Distill, Qwen2SeqCls-2.5, Gemma, Gemma2, Cohere, Olmo3 and SmolLM3 models Flash Attention compatible (#8155, #8156, #8157, #8158, #8160, #8196, #8197, #8198, #8200, #8304, #8305, #8306) by @albertvillanova, and the tiny Qwen2.5, Qwen2.5-VL, Cohere2, GLM-4 MoE, GraniteMoE and PhiMoE ones (#8147, #8148, #8169, #8283, #8284, #8285, #8286) by @qgallouedec. Test SFT on tiny VLMs with images under Flash Attention (#8201) and skip the SFT Flash Attention xfails on torch versions that leak checkpoint hooks (#8303), by @albertvillanova.

Tiny models that look like their references. Add tiny GraniteMoe, PhiMoE and GraniteMoeHybrid models (#7920, #7921, #7922) and quantize the tiny DeepSeek-V3 and GPT-OSS models like their references (#8058), by @qgallouedec. Add a tiny GLM-5.3-Flash script (#8068, #8119, #8125, #8069), compare tiny-model dtypes with references that only ship consolidated safetensors (#8238), write the tiny Mistral Large 4 FP8 checkpoint in the reference layout (#8239), scale the tiny DeepSeek-V3 FP8 blocks to 32x32 (#8240), drop the pinned revisions of the merged tiny models (#8241) and compare saved checkpoints with the reference in check_dtype_pattern (#8118), by @albertvillanova.

Chat template tests. Check the most-downloaded checkpoint of each stored template against the Hub (#7956), derive the training template pairs in the response parsing test (#8084), test that the assistant mask starts where the generation prompt ends, with and without reasoning (#8110, #8124), assert training templates fail like their originals instead of skipping (#8141), and xfail the DeepSeek assistant-mask tests on transformers 5.23.0.dev0 until #8228 (#8215), by @albertvillanova.

Tests that run what users run. Reward with a function, not a reward model, in GRPO and RLOO tests (#8193), train on conversational data in trainer tests (#8195), test Qwen3.5 loaded as a text-only causal LM (#7763), stop the sft_fa2 invariant class at step 4 (#8106) and skip the AsyncGRPO tests when requests is missing (#8291), by @qgallouedec. Build the OpenEnv harness loop with its real constructor (#7988), allow dropped group ids in the OpenEnv session failure test (#8029), fail instead of skip when GOLD test assets don't load (#8090), load the GOLD Countdown examples from Countdown-Task-GOLD (#8091), drop the Llama4 case from the tree packing refusal test (#8138), and skip experimental Qwen3-VL, Gemma4 and LFM2.5-VL tests on old transformers (#8086, #8087, #8088), by @albertvillanova.

Workflows. Install, build and publish with uv (#7883, #7884), fail self-hosted test jobs when pytest doesn't complete (#8006), test vLLM at both ends of the supported range (#7872), run CI when a draft PR is marked ready (#8100), skip the chat templates check on Dependabot PRs (#8152), pin ruff-pre-commit to a commit SHA (#8165) and doc-builder to v0.6.0 (#8154), and narrow then revert the Mistral Large 4 FP8 xfail (#8037, #8092), by @albertvillanova. Bump doc-builder for machine-translated docs (#8013) by @mishig25, and dependency bumps by @dependabot[bot] (#8151, #8153, #8179). Selective activation checkpointing on transformers 5.23 was wrapped and then unwrapped once transformers restored the old behavior (#8094, #8098), by @albertvillanova.

Dead code. Remove is_unsloth_available (#8043), OnlineDPOTrainer.process_vision_row (#8044), IS_SAGEMAKER_MP_POST_1_10 (#8045), the SDPO and SDFT config_cls attributes (#8046), the async rollout workers' _generation_start_time (#8047), WeaveCallback._eval_logger (#8048), an unused unpack in GOLD (#8049) and adjusted_mfu (#8245), by @qgallouedec.

New Contributors

What's Changed

Full Changelog: https://github.com/huggingface/trl/compare/v1.17.0...v1.18.0

Kaynak: GitHub sürümü v1.18.0

Daha yeni: 1.18.1Daha eski: 1.17.1TRL