StoryCoder: Narrative Reformulation for Structured Reasoning in LLM Code Generation
Summary
StoryCoder is a novel narrative reformulation framework designed to enhance large language model (LLM) code generation by transforming problem statements into coherent natural language narratives. Developed by Geonhui Jang, Dongyoon Han, and YoungJoon Yoo, this framework structures code generation questions into a task overview, constraints, and example test cases, guided by a selected algorithm and genre. This approach provides richer contextual structure compared to simple rephrasing, drawing inspiration from human information organization. Experiments conducted across 11 different LLMs on benchmarks such as HumanEval, LiveCodeBench, and CodeForces demonstrated an average improvement of 18.7% in zero-shot pass@10. The analysis indicates that StoryCoder guides models toward correct algorithmic strategies, reduces implementation errors, and promotes modular code structures, with benefits tied to narrative coherence and genre alignment.
Key takeaway
For AI Engineers developing LLM-powered code generation tools, integrating narrative reformulation frameworks like StoryCoder can substantially improve output quality. Your efforts to structure problem statements into coherent narratives, including task overviews, constraints, and test cases, will lead to more accurate and modular code. Consider aligning narrative genre and coherence to maximize performance gains, regardless of the underlying model's scale or architecture.
Key insights
Narrative reformulation of code problems significantly improves LLM code generation by structuring context.
Principles
- Structured problem representation is crucial for code generation.
- Narrative coherence and genre alignment enhance model performance.
Method
StoryCoder reformulates code generation questions into natural language narratives comprising a task overview, constraints, and example test cases, guided by algorithm and genre selection.
In practice
- Apply narrative reformulation to improve LLM code generation.
- Structure problem statements with task, constraints, and examples.
Topics
- LLM Code Generation
- Narrative Reformulation
- StoryCoder Framework
- Structured Reasoning
- HumanEval
Code references
Best for: AI Engineer, Research Scientist, AI Scientist, Machine Learning Engineer, NLP Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by Takara TLDR - Daily AI Papers.