Abstract
CodeInsight is a novel, expert-curated dataset comprising 3,409 Python coding challenges derived from Stack Overflow. Unlike existing benchmarks that focus on competitive programming or simple logic, CodeInsight targets practical "how-to" development queries. Each entry includes unit tests and standardized variable naming to ensure executability and reduce data contamination. Evaluation of state-of-the-art LLMs reveals specific failure modes in real-world coding tasks, providing a robust benchmark for practical code generation.
Introduction
While Large Language Models (LLMs) like ChatGPT and CodeLLAMA have revolutionized software development, they often struggle with the practical, "how-to" reality of daily coding. Existing benchmarks typically fall into two categories: hyper-specific competitive programming puzzles (e.g., APPS) or overly simplistic logic tests (e.g., HumanEval). These do not accurately mirror the real-world queries developers submit to platforms like Stack Overflow, such as manipulating Pandas DataFrames or utilizing specific library functions.
Furthermore, web-sourced datasets are often "noisy," containing non-executable code or overly verbose descriptions. There is also the significant risk of data contamination, where models might memorize Stack Overflow answers rather than learning underlying logic. CodeInsight addresses these gaps by providing a high-quality, executable, and curated resource for evaluating "development assistance" tasks.
Methodology
The researchers developed a rigorous four-stage pipeline to transform raw Stack Overflow data into a high-quality machine-learning resource:
- Filtering: Starting with 7,300 raw examples, the team filtered for authenticity, extractability, and executability.
- Normalization: To prevent models from relying on specific variable names, variables were standardized (e.g.,
dfifor DataFrames,arrifor arrays). - Expert Annotation: Five data science professionals refined natural language "intents" to be concise and precise.
- Unit Testing: Each example was equipped with three unique unit tests covering a normal scenario, an edge case, and an error situation to ensure functional correctness.
Dataset Characteristics
The resulting CodeInsight dataset contains 3,409 unique Python examples covering Pandas, Numpy, Regex, and over 70 standard libraries. Compared to other data-science-focused benchmarks like DS-1000, CodeInsight offers a broader variety of tasks and more concise problem descriptions, providing a more realistic representation of developer needs.
Results and Discussion
The authors benchmarked three leading open-source models: Mistral 7B, CodeLLAMA 13B, and Starcoder 15B.
- Performance Metrics: CodeLLAMA and Starcoder achieved similar Pass@1 accuracy, ranging between 45% and 48%. Interestingly, fine-tuning CodeLLAMA on just 20% of the CodeInsight training set yielded results nearly as good as using 80%, highlighting the high quality and information density of the curated examples.
- The "Return" vs. "Print" Trap: A notable finding was that models often failed by using
printinstead ofreturn, likely due to conversational training data. Explicitly prompting for a return statement improved Mistral's performance from 4.7% to 10.1%. - Complexity Analysis: Using Abstract Syntax Tree (AST) depth, the authors found that task difficulty does not always correlate linearly with lines of code, suggesting that syntactic complexity is a more nuanced measure of difficulty for LLMs.
- Mitigating Memorization: By rephrasing intents and standardizing code into function formats, the authors reduced GPT-4’s BLEU score while maintaining a high pass rate (64%), indicating that CodeInsight effectively tests logic over memorization.
Conclusion
While CodeInsight provides a robust benchmark, it is currently limited to Python and reflects the coding styles of its expert curators. Future work includes expanding to other programming languages and further categorizing "coding flavors" (e.g., loops vs. list comprehensions) to better understand LLM preferences and weaknesses. As libraries evolve, the dataset will require ongoing updates to remain a relevant tool for the research community.
Summary updated