Abstract: In previous studies, code-based models have consistently outperformed text-based models in reasoning-intensive scenarios. When generating our knowledge base for Retrieval-Augmented Generation (RAG), we observed that code-based models also perform exceptionally well in Chinese QA Pair Extraction task. Further, our experiments and the metrics we designed discovered that code-based models containing a certain amount of Chinese data achieve even better performance. Additionally, the capabilities of code-based English models in specified Chinese tasks offer a distinct perspective for discussion on the philosophical "Chinese Room" thought experiment.
Introduction
Published at COLM 2024, this research presents a counterintuitive finding in the development of Large Language Models (LLMs): English-centric models trained primarily on computer code often outperform models trained specifically on Chinese text when extracting high-quality Chinese question-answer (QA) pairs. This discovery suggests that for structured data tasks, structural reasoning and verbatim fidelity are more critical than native linguistic fluency.
The Challenge of QA Pair Extraction
Building effective Retrieval-Augmented Generation (RAG) systems requires high-quality datasets of QA pairs derived from proprietary documents. Automating this extraction is difficult because "fluent" general-purpose models often struggle with precision. They tend to "hallucinate" by incorporating outside knowledge or paraphrasing source material in ways that deviate from the ground truth.
The goal is to identify models that prioritize structural integrity and faithful data extraction over creative linguistic generation. As shown in Figure 1, the task requires identifying specific segments of text that directly answer a generated question without adding extraneous information.
Methodology and Custom Metrics
The researchers conducted Supervised Fine-Tuning (SFT) on various 7-billion-parameter (7B) models, comparing "Raw" Language Models (LMs) like Llama 2 and Qwen against "Code" LMs like Code Llama and DeepSeek Code. To evaluate performance beyond standard ROUGE scores, they developed three specialized metrics:
- CCR (Content Creation Rate): Measures the model's tendency to hallucinate new information.
- TEAC (Text Extraction Aggregation Count): Evaluates the ability to synthesize information from multiple disparate parts of a document.
- REJ (Reject Capability): Tests if a model can correctly identify and reject "noise" documents that do not contain sufficient information to form a valid QA pair.
Experiments were conducted on a custom dataset comprising over 143,000 manually annotated documents for training and a challenging test set of 300 private technical documents, including 100 noise documents designed to trigger the rejection mechanism.
Why Code Models Excel: Structure Over Fluency
The superior performance of code models stems from their training on highly structured data (Python, C++, HTML, etc.), making them "format experts." In the context of QA extraction, these models treat Chinese text as structured symbols to be manipulated rather than a language to be interpreted.
This leads to a "copying advantage" where verbatim extraction—a necessity for data integrity—is prioritized over the conversational paraphrasing typical of general LMs. This phenomenon mirrors John Searle’s "Chinese Room" thought experiment: the model does not "understand" Chinese but follows a complex manual (code-based weights) to process symbols accurately. Interestingly, models with less Chinese pre-training often hallucinated less because they lacked the "common knowledge" that might otherwise bleed into the specific facts of a source document.
Comparative Performance Analysis
The empirical results strongly favor code-based architectures. As detailed in the performance table below, Code Llama 7B achieved an Expert Score of 97, significantly outperforming the standard Llama 2 7B, which scored 85.
Key findings from the comparative analysis include:
- Hallucination Suppression: Code models showed lower CCR scores (e.g., Code Llama at 1.42 vs. Llama 2 at 1.76), indicating higher groundedness.
- Architecture vs. Training: DeepSeek Code 6.7B (Expert Score: 92) beat its sibling, DeepSeek LLM 6.7B (Expert Score: 78), despite sharing the same underlying architecture, highlighting the impact of code-centric pre-training.
- The Goldilocks Zone: Adding a moderate amount of Chinese vocabulary (8,076 tokens) to Code Llama improved ROUGE-L scores to 58.51, but full-scale Chinese pre-training tended to reintroduce hallucination issues.
Conclusion
This study demonstrates that for specialized data extraction tasks, the structural reasoning capabilities of code-based models provide a significant advantage over general linguistic fluency. Future work will explore whether these advantages persist at the 70B+ parameter scale and investigate a "Controlled AI Framework" where English-centric code models serve as safeguards to ensure AI operations remain strictly within the confines of provided source material.
Summary updated