跳到正文
arXiv cs.AI· Zhe Yin, Yuling Shi, Xiaodong Gu, Beijun Shen·· 14 小时前AI 评分38

高效 AI 编程的推理模式:一项实证研究

Reasoning Patterns for Efficient AI Coding: An Empirical Study

AI 导读

一项实证研究将大型推理模型(LRM)的推理轨迹转为结构化动作序列,在四类编程任务中归纳出四种通用推理模式:代码生成的设计到实现、执行推理的状态追踪、调试的证据—修复—复查、翻译的语义映射。研究还区分出与有效轨迹相关的正向模式和与无效轨迹相关的负向模式,并验证了任务识别、模式引导提示词和负向模式感知提前停止三项应用,后者可大幅降低 API token 用量而 pass@1 仅小幅下降。

正文 · 原文

View PDF HTML (experimental)

Abstract:Large Reasoning Models (LRMs) generate long reasoning traces that expose intermediate inference behavior, offering opportunities to study and control reasoning in AI coding. However, the underlying patterns in these traces and their potential for analyzing and guiding coding models remain poorly understood, limiting systematic characterization and inference-time control of LRM reasoning. We conduct an empirical study of reasoning patterns across four representative coding tasks. We transform reasoning traces into structured action sequences and mine recurring fragments using within-task support, cross-task contrasts, and valid--invalid support contrasts. We characterize four general reasoning patterns by coding agents: design-to-implementation for code generation, state tracing for execution reasoning, evidence--fix--recheck for debugging, and semantic mapping for translation. We further identify positive and negative patterns associated with valid and invalid reasoning traces, respectively. Positive patterns reflect verification-driven convergence, whereas negative patterns reflect repeated design revision, reflection, and knowledge recall without closure. To demonstrate their practical utility, we evaluate three pattern-based applications: task identification, pattern-guided prompting, and pattern-aware early stopping. Features capturing general reasoning patterns enable accurate task identification from reasoning traces without accessing task descriptions or final answers. Prompting guided by positive and negative patterns improves the overall accuracy of downstream tasks, while negative pattern-aware early stopping substantially reduces API-reported token usage with only a modest decrease in pass@1. All three applications also generalize to previously unseen models, showing that reasoning patterns can support both the analysis and control of LRM behavior in AI coding.
Subjects: Software Engineering (cs.SE); Artificial Intelligence (cs.AI)
Cite as: arXiv:2610.34943 [cs.SE]
  (or arXiv:2610.34943v1 [cs.SE] for this version)
  https://doi.org/10.48550/arXiv.2610.34943

arXiv-issued DOI via DataCite (pending registration)

Submission history

From: Zhe Yin [view email]
[v1] Mon, 26 Oct 2026 07:10:58 UTC (224 KB)

来源:arXiv cs.AI · arxiv.org