Here is a blog-style summary of the paper.
TL;DR
While reward models (RMs) are essential for aligning language models, code generation post-training has remained bottlenecked by a strict reliance on execution feedback (running test cases). This paper introduces Themis, a suite of multilingual, multi-criteria code reward models (ranging from 600M to 32B parameters) capable of scoring code across five distinct quality dimensions—including non-functional traits like security and efficiency—across eight programming languages.
What Problem Does This Paper Address?
The current paradigm for optimizing code generation models relies heavily on execution feedback: running model-generated code against unit tests to check if it works. While effective for verifying basic functional correctness, this approach has severe limitations:
- It ignores non-functional quality: Code needs to be more than just correct; it should be secure, memory-efficient, fast, and readable. Execution feedback cannot evaluate these traits.
- It requires self-contained code: You can only easily execute code that doesn't depend on external libraries or complex environments, which is unrepresentative of real-world software engineering.
- Language barriers: It is notoriously difficult to set up automated, synthetic execution environments for languages with module-level compilation units like Rust, Go, or Swift.
Existing code reward models fail to fill this gap because they are almost exclusively trained on simple, dated Python competitive programming datasets. When evaluated on non-functional criteria, current RMs perform no better than random guessing.
Methods
The authors developed a robust training recipe to build a flexible, multi-criteria scalar reward model.
- Data Mining Pipeline: To capture real-world code preferences, the authors built a pipeline to mine single-file GitHub commits. They used specialized classifiers to categorize commits by quality dimensions, filtered them using LLM consensus, and synthetically generated "inverse instructions" to turn code diffs into preference pairs.
- Two-Stage Training:
- Preference Model Pre-Training (PT): The models are first trained on general human preferences (helpfulness, harmlessness) to establish a baseline understanding of evaluation.
- Preference Modeling (PM): The models are then trained on code-specific multi-criteria preferences.
- Conditional Prompting Strategy: Instead of training separate models for different criteria, the authors used a single scalar RM trained with system prompts that explicitly define the evaluation criterion (e.g., "Memory Efficiency" or "Security Hardness"). This allows the model to dynamically shift its scoring focus at inference time based on user requirements.
Datasets
The paper introduces three major open-source artifacts:
- Themis-CodeRewardBench: An evaluation benchmark containing ~8.9k diverse code preference pairs across 5 quality dimensions and 8 programming languages (C, C#, C++, Go, Java, JavaScript, Python, Ruby).
- Themis-CodePreference: The largest open-source collection of code preferences to date, featuring over 350k preference pairs used for the primary training stage.
- Themis-GeneralPreference: A dataset of 110k+ general-domain and natural language preferences used for the pre-training phase.
Key Insights and Ideas
- Current RMs are blind to non-functional code quality: Evaluation on
Themis-CodeRewardBenchrevealed that existing state-of-the-art reward models degenerate to near-random performance when asked to judge code efficiency or security. - Prompting beats architectural splitting: Specifying the evaluation criteria textually in the system prompt successfully disentangles competing objectives (like speed vs. memory), eliminating the need for complex multi-head architectures or model-merging techniques.
- Asymmetric Transfer: Training models on Functional Correctness transfers reasonably well to non-functional criteria (because bug fixes often clean up code structure), but training only on non-functional criteria (like readability) transfers poorly to correctness.
- Typological Cross-Lingual Transfer: Cross-lingual transfer follows language families: models trained purely on Python transfer better to dynamically typed languages (JavaScript, Ruby), while Java-trained models transfer better to statically typed ones (C++, C#).
Key Results
- State-of-the-Art Performance: The largest model,
Themis-RM-32B, established a new state-of-the-art across all criteria on the benchmark, achieving an average preference accuracy of 91.82%, significantly outperforming massive general-purpose models likeNemotron-70B(78.39%). - Pound-for-Pound Excellence: The smallest model,
Themis-RM-0.6B(79.26% average accuracy), outperformed general-purpose reward models that are more than 100× larger. - Downstream Competence: In listwise re-ranking tasks (finding the correct solution out of 40 candidate outputs),
Themis-RM-32Bachieved a 97.65% Hits@10 score for C++, matching or exceeding models explicitly specialized only for competitive programming code. It also demonstrated superior robustness against adversarial "judge-hacking" behaviors.
Limitations and Future Work
While Themis represents a massive leap forward for code reward modeling, the authors note a few areas for growth:
- Synthetic Instruction Artifacts: The inverse instructions generated for GitHub commits rely on frontier LLMs, which can introduce subtle distribution shifts or synthetic artifacts.
- Language Scope: The evaluation and training are currently bounded by eight high- and medium-resource languages, leaving lower-resource or domain-specific languages unaddressed.
- Downstream Post-Training: Future work will focus on directly integrating the Themis-RM suite into reinforcement learning pipelines (like PPO or DPO) to verify downstream generation improvements.
Summary updated