Abstract
While existing benchmarks for Large Language Models (LLMs) in the coding domain primarily focus on functional correctness—the ability to pass unit tests—they often overlook technical factuality. This paper introduces CodeSimpleQA, a bilingual benchmark and a massive 66.9-million-sample dataset designed to evaluate and improve the accuracy of technical information provided by LLMs. By implementing a pipeline that combines supervised fine-tuning (SFT) and Group Relative Policy Optimization (GRPO), we demonstrate a path toward reducing technical hallucinations and scaling factual knowledge in specialized domains.
1. Introduction
In modern software development, LLMs are used not only to generate code snippets but also as technical consultants for API documentation, architectural best practices, and debugging strategies. However, a significant "factuality gap" exists: a model may generate syntactically correct code while hallucinating the specific version requirements of a library or the security implications of a design pattern.
Existing benchmarks like HumanEval or MBPP measure functional correctness but fail to capture these factual inaccuracies. General-knowledge benchmarks, such as SimpleQA, lack the specialized, rapidly evolving technical depth required for computer science. CodeSimpleQA addresses this by providing a rigorous framework for evaluating "code factuality" across multiple languages and domains.
2. The CodeSimpleQA Framework
2.1 Benchmark Construction
The CodeSimpleQA benchmark consists of 1,498 high-quality question-answer pairs, split between English (782) and Chinese (716). The dataset covers 15+ programming languages and 21 distinct computer science domains, including Cybersecurity, Bioinformatics, and Database Management. To ensure reliability, all answers are grounded in official documentation and have undergone human verification.
2.2 Large-Scale Training Data
To facilitate the scaling of technical knowledge, the authors released CodeSimpleQA-Instruct, a massive corpus containing 66.9 million samples (53.6M English, 13.4M Chinese). This dataset was constructed using a sophisticated pipeline:
- Data Acquisition: Crawling official documentation, technical blogs, and community forums like Stack Overflow.
- Clustering: Utilizing semantic embeddings and DBSCAN clustering to organize documents into coherent knowledge clusters.
- Verification: Employing an "LLM-as-a-Judge" framework to generate and verify QA pairs, ensuring they are time-invariant, unambiguous, and factually grounded.
3. Post-Training Methodology
The research explores two primary methods for internalizing this technical knowledge:
- Supervised Fine-Tuning (SFT): Rejection-based SFT is used to help models internalize stable, core programming concepts.
- Reinforcement Learning (GRPO): The study utilizes Group Relative Policy Optimization (GRPO)—the technique popularized by DeepSeek-R1—to align model outputs with factual truth without the overhead of a separate reward model.
4. Key Insights and Results
4.1 Model Performance and Scaling
Evaluation of frontier models (e.g., GPT-4o, Claude 3.5 Sonnet) reveals that even top-tier systems struggle with code factuality, typically achieving F1 scores between 50% and 65%. The study identifies a logarithmic scaling law: as parameter counts increase, factuality improves predictably. Notably, reasoning-centric models (such as the OpenAI o-series) consistently outperform standard chat models, suggesting that internal chain-of-thought processes aid in factual retrieval.
4.2 RAG vs. SFT
A critical finding of this research is the trade-off between Retrieval-Augmented Generation (RAG) and SFT. While RAG is superior for highly volatile or very recent documentation (post-2024), SFT remains more efficient and consistent for "stable" technical knowledge. This suggests a hybrid approach is necessary for production-grade technical assistants.
4.3 Domain and Language Disparities
Models exhibit high proficiency in mainstream areas like Web Technologies and Software Engineering but show significant performance drops in specialized fields like Bioinformatics and Theory of Computation. Interestingly, models often performed slightly better on the Chinese portion of the benchmark, potentially due to the specific density or quality of the technical training data available in that language.
5. Conclusion and Future Work
CodeSimpleQA provides a necessary pivot from functional correctness to technical factuality in code LLM evaluation. While the introduction of GRPO and massive instruction datasets shows promise in reducing hallucinations, challenges remain. Future work will focus on expanding the benchmark to more languages, evaluating complex multi-step technical reasoning, and mitigating the inherent biases in LLM-based evaluation frameworks. By scaling factuality, we move closer to AI systems that serve as truly reliable technical experts.
Summary updated