Usage of Large Language Model for Code Generation Tasks: A Review
TL;DR Highlight
A survey paper summarizing the current state and limitations of LLM-based code generation.
Who Should Read
Developers and researchers who want a comprehensive overview of where LLM code generation stands today and what challenges remain.
Core Mechanics
- Covers the full landscape of LLM-based code generation: models, benchmarks, prompting strategies, and evaluation metrics
- Identifies key limitations: poor performance on complex multi-file tasks, limited understanding of project-level context, and hallucinated APIs
- Benchmarks like HumanEval are saturated and no longer discriminate between top models; harder benchmarks are needed
- Security and correctness of generated code remain open problems — models frequently produce vulnerable or subtly wrong code
- Highlights the gap between benchmark performance and real-world usability
Evidence
- Comprehensive review of dozens of models and benchmarks published through 2024
- HumanEval pass@1 rates for top models now exceed 90%, indicating benchmark saturation
- Multiple studies show high rates of security vulnerabilities in LLM-generated code
How to Apply
- Use this survey as a reference when deciding which code generation model or prompting strategy to adopt for your use case.
- Don't rely solely on HumanEval scores when comparing models — look at harder benchmarks like SWE-bench or LiveCodeBench.
- Always run static analysis and security scanners on LLM-generated code before merging to production.
Try It
# Example of improving code generation quality with few-shot prompts (OpenAI API)
import openai
client = openai.OpenAI()
prompt = """
Please write a function based on the examples below.
Example 1:
# Returns the sum of two numbers
def add(a, b):
return a + b
Example 2:
# Returns the product of two numbers
def multiply(a, b):
return a * b
Now implement the following:
# A function that returns the difference between the maximum and minimum values in a list
"""
response = client.chat.completions.create(
model="gpt-4",
messages=[
{"role": "system", "content": "You are an expert Python developer. Write clear and efficient code."},
{"role": "user", "content": prompt}
],
temperature=0.2 # Low temperature is recommended for code generation
)
print(response.choices[0].message.content)Terminology
Related Papers
Gemini 4 Neon is the new #1 on the Models Engineering Index
Gemini 4 Neon ranks first on the Models Engineering Index with 68.0, combining multiple benchmarks.
LLMs can read and write executables byte by byte from a hex dump
Given only a hex dump and no tools, an LLM analyzed, patched and wrote working executables.
Claude was trained on protein sequences at scale
Next-amino-acid tests on obscure proteins show only the latest Claude models predict them
Remembered as Brief: Stored Preferences SilentlyRemove Decision-Critical Information
A stored 'keep it short' preference silently drops warnings; listing must-know points first restores content.
All AI-generated code should be Open Source
A blog argues AI-generated code should be open source; most HN commenters disagreed.
What thousands of conversations look like inside a language model
Mapping Qwen3-1.7B states showed Chinese sitting apart from English, while German and Croatian overlapped it.
AI, activity, and outcomes in software engineering
AI sped up writing code, but shipping speed did not rise as much, says a talk
LLMs Play Zachtronics' TIS-100
16 LLMs played TIS-100 and set 133 new Pareto frontier points across 18 puzzles