atlas

Research map / Large language models / Agents, code and math

Can LLM Replace Stack Overflow? A Study on Robustness and Reliability of Large Language Model Code Generation

AAAI 2024 · Large language models › Agents, code and math · approach: Code generation benchmarks · 63 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes RobustAPI, a benchmark of 1208 Stack Overflow Java API questions plus an AST-based checker to measure API misuse in LLM-generated code, finding widespread misuse even among GPT-4 outputs.

Problem

LLM code generation is evaluated mostly for functional correctness on small interview-style tasks, leaving the reliability and robustness of real-world API usage (e.g., resource leaks, missing exception handling) unmeasured.

Approach

Build a benchmark from real Stack Overflow questions about 18 popular Java APIs, formalize 41 API usage rules as call sequences and control structures, and detect misuse by AST-based call-sequence matching against those rules rather than by test execution.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
add a correct same-API usage example to the prompt (ablation)GPT-3.5 · RobustAPIAPI Misuse Rate: 62.97% -> 38.56%Helped
add a correct same-API usage example to the prompt (ablation)GPT-4 · RobustAPIAPI Misuse Rate: 68.81% -> 54.40%Helped
add a correct same-API usage example to the prompt (ablation)Vicuna-1.5 · RobustAPIAPI Misuse Rate: 45.66% -> 42.53%Helped
add a correct same-API usage example to the prompt (ablation)Llama-2 · RobustAPIAPI Misuse Rate: 7.34%$^\ast$ -> 64.47%Hurt
add an irrelevant one-shot example (ablation)GPT-3.5 · RobustAPIAPI Misuse Rate: 62.97% -> 68.09%Hurt
add an irrelevant one-shot example (ablation)GPT-4 · RobustAPIAPI Misuse Rate: 68.81% -> 70.38%Hurt
add an irrelevant one-shot example (ablation)Vicuna-1.5 · RobustAPIAPI Misuse Rate: 45.66% -> 57.85%Hurt
increase temperature from T=0 to T=0.5 (ablation)GPT-3.5 with one-shot-relevant · RobustAPIAPI Misuse Rate: 38.56% -> 39.77%No clear effect
increase temperature from T=0 to T=1.0 (ablation)GPT-3.5 with one-shot-relevant · RobustAPIAPI Misuse Rate: 38.56% -> 39.06%No clear effect
replace a one-shot-relevant example with API usage rules (ablation)GPT-3.5 · RobustAPI, T=0API Misuse Rate: 38.56% -> 65.01%Hurt
increase sampling from Pass@1 to Pass@5 (ablation)GPT-3.5 with one-shot-relevant · RobustAPIAPI Misuse Rate: 39.06% -> 21.98%Helped
increase sampling from Pass@1 to Pass@10 (ablation)GPT-3.5 with one-shot-relevant · RobustAPIAPI Misuse Rate: 39.06% -> 16.51%Helped

Surprising findings

Limitations

Experimental setup

Datasets: ExampleCheck Stack Overflow questions

Benchmarks: RobustAPI

Metrics: API misuse rate compilation rate overall misuse percentage pass@k

Baselines: GPT-3.5 GPT-4 Llama-2 Vicuna-1.5 deepseek-coder-6.7b-base deepseek-coder-6.7b-instruct

Builds on: ExampleCheck

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy