Skip to content

Conversation

izlley
Copy link

@izlley izlley commented Jun 26, 2025

Description

This pull request introduces a new reward function, lang_consistency reward, to enhance the linguistic consistency of model outputs during reinforcement learning (e.g., GRPO).

Motivation

In multilingual or even monolingual contexts, it's crucial for a model to adhere to the target language specified in a prompt or conversation. This reward function directly incentivizes this behavior by assigning a positive reward (1.0) only when the language of the generated completion matches the expected language. This helps prevent language drift and ensures more reliable and predictable model behavior.

Inspired by the "language consistency reward" concept from the DeepSeek-R1 paper, this function provides a valuable tool for fine-tuning models where strict language adherence is required.

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.

1 participant