StoryCoder:一种通过叙事重构促进大语言模型代码生成结构化推理的框架 / StoryCoder: Narrative Reformulation for Structured Reasoning in LLM Code Generation
1️⃣ 一句话总结
这篇论文提出了一个名为StoryCoder的框架,它通过将代码生成问题重构成一个包含任务概览、约束和测试用例的连贯故事,来引导大语言模型采用更清晰的算法策略和模块化结构,从而显著提升代码生成的准确性和质量。
Effective code generation requires both model capability and a problem representation that carefully structures how models reason and plan. Existing approaches augment reasoning steps or inject specific structure into how models think, but leave scattered problem conditions unchanged. Inspired by the way humans organize fragmented information into coherent explanations, we propose StoryCoder, a narrative reformulation framework that transforms code generation questions into coherent natural language narratives, providing richer contextual structure than simple rephrasings. Each narrative consists of three components: a task overview, constraints, and example test cases, guided by the selected algorithm and genre. Experiments across 11 models on HumanEval, LiveCodeBench, and CodeForces demonstrate consistent improvements, with an average gain of 18.7% in zero-shot pass@10. Beyond accuracy, our analyses reveal that narrative reformulation guides models toward correct algorithmic strategies, reduces implementation errors, and induces a more modular code structure. The analyses further show that these benefits depend on narrative coherence and genre alignment, suggesting that structured problem representation is important for code generation regardless of model scale or architecture. Our code is available at this https URL.
StoryCoder:一种通过叙事重构促进大语言模型代码生成结构化推理的框架 / StoryCoder: Narrative Reformulation for Structured Reasoning in LLM Code Generation
这篇论文提出了一个名为StoryCoder的框架,它通过将代码生成问题重构成一个包含任务概览、约束和测试用例的连贯故事,来引导大语言模型采用更清晰的算法策略和模块化结构,从而显著提升代码生成的准确性和质量。
源自 arXiv: 2604.14631