Skip to main content
Back

Alibaba's MeRF Tells AI the Rules Before Training and Boosts Reasoning 27%

MeRF boosts RLVR training by simply telling models the scoring rules upfront, yielding consistent gains across math, logic, and coding benchmarks

Pro

Paper, Full Access
  • MeRF injects the reward function as natural language into the training prompt, letting models know their scoring criteria during RLVR fine-tuning.
  • The method requires no architectural changes, no extra data, and no new loss terms -- just a modified system prompt.
  • On K&K Logic Puzzles, MeRF achieves up to a 27% relative improvement over the RLVR baseline for Qwen2.5-7B-Instruct.
  • On math benchmarks (AIME, AMC23, MATH500), MeRF gains up to +4.5% pass@8 on average over standard RLVR.
  • Gains come from better exploration during training, not from reading the prompt at inference time -- models generalize without the motivation in the prompt.
  • The method works across 6 model families but shows diminishing returns for very small or weak models that cannot parse the motivation text.

Reinforcement learning has become the go-to recipe for building reasoning models. The formula is straightforward: generate a bunch of responses, check which ones are correct, and nudge the model toward the winners. But there is a fundamental inefficiency baked into this loop that a new paper from Nanyang Technological University and Alibaba's Tongyi Lab wants to fix. Their method, called Motivation-enhanced Reinforcement Finetuning (MeRF), asks a deceptively simple question: why not just tell the model how it will be graded?

The blind spot in RLVR

Reinforcement Learning with Verifiable Rewards (RLVR) is the training paradigm behind models like DeepSeek-R1 and OpenAI o1. Instead of relying on human raters, RLVR leverages deterministic verifiers providing binary feedback based on answer correctness, making it well-suited for math and code. The model generates many candidate responses, receives a reward signal for the correct ones, and updates its weights accordingly via a policy gradient algorithm.

The problem is that this process is completely opaque to the model during generation. A critical failure mode for RLVR is the exploration inefficiency problem: when all trajectories in a sample group are incorrect, the group advantage collapses to zero, yielding no gradient for policy updates. The model has to stumble onto good responses before it can learn from them. Existing RLVR methods focus solely on the final answer's correctness while ignoring the verification of the reasoning process, and this reliance on a final answer creates a sparse binary reward signal that destabilizes the training process.

The authors frame it vividly: imagine trying to learn a game without ever being told the rules. You play, occasionally win, and slowly reverse-engineer what "winning" means from scattered feedback. That is exactly how current RLVR works. The model is blind to the optimization objective during the very generation step that matters most.

Just tell it the rules

MeRF's fix is almost embarrassingly simple. Rather than keeping the reward function hidden from the model, it injects a natural-language description of the reward function directly into the system prompt before training begins. The authors call this an in-context motivation. The model now knows, at generation time, exactly what criteria it will be judged on.

MeRF pipeline diagram and accuracy comparison bar chart showing MeRF vs RLVR baseline vs Base Model

For a Knights and Knaves (K&K) logic puzzle, the motivation looks like this in the system prompt:

You will get evaluated following Evaluation Scoring Rules:
- Correctness Score:
  - If your final answer is correct, score 2
  - If your answer is understandable but wrong, score -1.5
  - If your answer is not parsable or incomplete, score -2
- Format Score:
  - If you follow the tag format exactly as above, score 1
  - Otherwise, score -1

That is the entire intervention. No architectural changes, no new loss terms, no extra training data. The reward specification is already written in natural language (because verifiable rewards are rule-based by definition), so injecting it costs nothing. The key insight is that LLMs already have strong in-context learning abilities, and MeRF simply routes the reward signal through that existing capability rather than relying solely on gradient updates.

How it actually works under the hood

The performance gain from MeRF is not simply the model reading the rules at inference time and following them. The authors carefully ablated this. When you give the base model the motivation at test time without any MeRF training, nothing improves. The gain is almost entirely a training-time effect.

Here is what the analysis reveals about the mechanism:

  • Better exploration from day one. Because the model knows what a good answer looks like, it generates more correct responses early in training. This means more positive reward signals, which means more useful gradient updates. The pass@8 metric (whether at least one of 8 sampled responses is correct) improves faster and keeps improving, whereas standard RLVR's pass@8 plateaus quickly.
  • Higher entropy throughout training. Standard RLVR collapses to suboptimal strategies early, often learning to game the format reward while ignoring correctness. MeRF maintains higher output entropy, meaning the model keeps exploring diverse reasoning paths instead of converging prematurely.
  • Amplification effect. The initial boost in exploration quality compounds over training steps. MeRF reaches the same pass@4 and pass@8 performance at step 140 that standard RLVR barely achieves by step 280.
  • Generalizes without the prompt. Despite being trained with the motivation in the prompt, MeRF models perform comparably at inference time whether or not the motivation is included. The model internalizes the reward structure rather than depending on the prompt as a crutch.

The authors also tested what happens with a misleading motivation, one that assigns opposite scores (correct answers get penalized, wrong answers get rewarded). Initially the model is confused and performance drops. But over training, the model learns to discount the adversarial signal and eventually outperforms the RLVR baseline anyway, because the full description of the reward structure is still informative even when the scores are inverted. Attention heatmaps confirm the model learns to attend to semantically meaningful motivation tokens like "correct," "score," and "format" while tuning out misleading signals.

What the numbers say

The team ran MeRF across six model variants: Qwen2.5-7B-Base, Qwen2.5-7B-Instruct, Qwen2.5-7B-Instruct-1M, Qwen2.5-14B-Instruct, DeepSeek-R1-Distill-Qwen-1.5B, and DeepSeek-R1-Distill-Llama-8B. Benchmarks included K&K Logic Puzzles (7 difficulty levels), AIME 2024 and 2025, AMC23, MATH500, and CountDown.

On K&K Logic Puzzles, the gains are substantial. For Qwen2.5-7B-Instruct:

  • Base model average accuracy: 0.10
  • RLVR baseline: 0.51
  • MeRF: 0.65 (a 27% relative improvement over RLVR)

On math benchmarks (AIME24, AIME25, AMC23, MATH500) using Qwen2.5-7B-Base, MeRF achieves consistent improvements over the RLVR baseline in most metrics across all datasets, with an average gain of 3.40%, 1.13%, 3.50%, and 4.50% in pass@1, pass@2, pass@4, and pass@8, respectively. The gains are more pronounced at higher pass@k values, consistent with the exploration story: MeRF makes the model more likely to find a correct answer when given multiple tries. MeRF also generalizes to agentic tasks, outperforming RLVR on the Natural Questions benchmark when the model uses a search engine tool for reasoning.

When to use it and when not to

MeRF is a strong fit for any RLVR training setup where:

  • The reward function is rule-based and can be described in natural language (math, code, logic puzzles, structured output tasks)
  • You are working with models that have reasonable instruction-following ability (the base model needs to understand the motivation text)
  • You want faster convergence without adding compute or data
  • You are training on tasks with sparse rewards, where the model rarely generates correct responses early in training

The method has real limitations worth knowing. The motivation is static throughout training, meaning it cannot adapt as the model improves and the hard cases shift. The authors flag this as an open direction: dynamic motivations that evolve with the model's capability could squeeze out more gains. Additionally, for models of weak generalization capability, how to efficiently implement RLVR and better leverage the in-context motivation for more efficient reinforcement finetuning is still an open question. Tiny models like DeepSeek-R1-Distill-Qwen-1.5B show only marginal gains, suggesting the model needs sufficient capacity to actually parse and use the motivation text.

The real takeaway

What makes MeRF interesting is not just the performance numbers. It is the conceptual reframing it offers. Large reasoning models such as DeepSeek-R1, QwQ, and Kimi-1.5 have demonstrated that RLVR enables superior generalization and robustness compared to SFT alone. But the field has largely treated RLVR as a black-box optimization process where the model is a passive recipient of reward signals. MeRF suggests that the model's own in-context learning machinery is an underutilized channel for transmitting reward information, one that operates in parallel with gradient updates and can dramatically accelerate the learning process.

The implementation is available through the VeRL and Logic-RL codebases, and the full prompt designs for K&K, math, and CountDown tasks are included in the paper's appendix. If you are running RLVR experiments, this is a zero-cost modification that is worth trying on your next training run.