---
title: "Vision Language Model Alignment in TRL ⚡️"
description: "TRL adds vision language model support for several alignment methods."
url: "https://swe.quest/articles/vision-language-model-alignment-in-trl-e64e05c10318c68f"
canonical: "https://huggingface.co/blog/trl-vlm-alignment"
source: "Hugging Face"
published: "2025-08-07"
difficulty: "hard"
kind: "How-to"
reading_minutes: 12
tags: ["model-training","llms","computer-vision","python"]
---

# Vision Language Model Alignment in TRL ⚡️

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2025-08-07, 12 min read, How-to. Original: [https://huggingface.co/blog/trl-vlm-alignment](https://huggingface.co/blog/trl-vlm-alignment)

## Summary

TRL adds vision language model support for several alignment methods. New are Mixed Preference Optimization (MPO), Group Relative Policy Optimization (GRPO) and its sequence-level variant GSPO, alongside multimodal RLOO, Online DPO and native SFTTrainer support. MPO is implemented in DPOTrainer as a weighted combination of DPO sigmoid, BCO and SFT losses, which the MPO paper reports gives a 6.2-point MathVista gain. GRPO uses custom format and accuracy reward functions. GSPO is enabled through GRPOConfig with sequence-level importance sampling, which is mainly useful for MoE models. Code snippets show each trainer config, and a vibe-check comparison on Qwen2.5-VL-3B shows the GRPO and GSPO runs reaching the correct geometry answer where the base and MPO models do not.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Computer vision](https://swe.quest/tags/computer-vision.md) (AI & ML)
- [Python](https://swe.quest/tags/python.md) (Languages)

## Prerequisites

- Preference optimization (DPO) ([easy posts on Performance engineering](https://swe.quest/tags/performance.md?difficulty=easy))
- Reinforcement learning for LLMs ([easy posts on Model training](https://swe.quest/tags/model-training.md?difficulty=easy))
- Hugging Face transformers

## Keywords

TRL, GRPO, GSPO, MPO, DPO, RLOO, Qwen2.5-VL, vLLM

## Related posts

- [Preference Optimization for Vision Language Models](https://swe.quest/articles/preference-optimization-for-vision-language-models-a84799e96613bf21.md): Hugging Face · 2024-07-10 · Hard · 11 min read · Model training, Computer vision, LLMs, Python
  TRL now supports direct preference optimization (DPO) for vision language models, trained on chosen/rejected answer pairs rather than fixed labels.
- [Preference Tuning LLMs with Direct Preference Optimization Methods](https://swe.quest/articles/preference-tuning-llms-with-direct-preference-optimization-methods-6edec5434e6d7272.md): Hugging Face · 2024-01-18 · Hard · 9 min read · Model training, LLMs, Evaluation
  An empirical comparison of three RL-free preference alignment methods (DPO, IPO and KTO) on two SFT'd 7B models, Zephyr-7b-beta-sft and OpenHermes-2.5-Mistral-7B, sweeping β from 0.01 to 0.9 with TRL's DPOTrainer and scoring the results on MT-Bench.
- [TRL v1.0: Post-Training Library Built to Move with the Field](https://swe.quest/articles/trl-v1-0-post-training-library-built-to-move-with-the-field-09da5ced251e79bc.md): Hugging Face · 2026-03-31 · Medium · 15 min read · Model training, Open source, API design, Python, LLMs
  TRL v1.0 turns Hugging Face's post-training codebase, now covering 75+ methods and downloaded 3M times a month, into a library with an explicit stability contract.
- [Vision Language Models Explained](https://swe.quest/articles/vision-language-models-explained-92cc71897cd36570.md): Hugging Face · 2024-04-11 · Medium · 8 min read · Computer vision, LLMs, Model training, Evaluation, Python
  Vision language models combine an image encoder, a projector that aligns image features with text embeddings, and a text decoder that generates text from both inputs.
- [Putting RL back in RLHF](https://swe.quest/articles/putting-rl-back-in-rlhf-dbdbc5d62840e65d.md): Hugging Face · 2024-06-12 · Hard · 11 min read · Model training, LLMs, Python
  RLOO (REINFORCE Leave-One-Out) is now available as a trainer in Hugging Face TRL.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
