多轮人-大语言模型协作代码生成中交互恶臭的实证研究
An Empirical Study of Interaction Smells in Multi-Turn Human-LLM Collaborative Code Generation
AI总结:
本文通过分析真实用户-大语言模型交互数据,揭示多轮协作代码生成中的交互恶臭现象,提出InCE框架以提升交互质量。
摘要:
大型语言模型(LLMs)已革新代码生成,从静态工具演变为动态对话接口,促进复杂多轮协作编程。尽管LLMs在生成独立代码片段方面表现出色,但在长对话中维持上下文一致性存在困难,阻碍了协作过程。现有基准主要强调最终输出的功能正确性,忽视了交互过程中的潜在质量问题,即交互恶臭。本文通过分析WildChat和LMSYS-Chat-1M数据集中的采样用户-LLM交互,系统研究人类-LLM代码生成任务中的交互恶臭现象。首先,通过手动开放式卡片排序建立交互恶臭的首个分类法,将其分为用户意图质量、历史指令合规性和历史响应违规三大类别。接着,定量评估六个主流LLM,分析交互恶臭在不同模型中的分布。最后,提出Invariant-aware Constraint Evolution(InCE)框架,通过显式提取全局不变量和预生成质量审计,提升多轮交互质量。实验结果表明,该轻量级缓解方法显著提高了任务成功率,并有效抑制交互恶臭的发生。
英文摘要:
Large Language Models (LLMs) have revolutionized code generation, evolving from static tools into dynamic conversational interfaces that facilitate complex, multi-turn collaborative programming. While LLMs exhibit remarkable proficiency in generating standalone code snippets, they often struggle to maintain contextual consistency during extended interactions, creating significant obstacles in the collaboration process. Existing benchmarks primarily emphasize the functional correctness of the final output, overlooking latent quality issues within the interaction process itself, which we term Interaction Smells. In this paper, we conduct an empirical study on sampled real-word user-LLM interactions from WildChat and LMSYS-Chat-1M datasets to systematically investigate Interaction Smells in human-LLM code generation tasks from the perspectives of phenomena, distribution, and mitigation. First, we establish the first taxonomy of Interaction Smells by manually performing open card sorting on real-world interaction logs. This taxonomy categorizes Interaction Smells into three primary categories, i.e., User Intent Quality, Historical Instruction Compliance, and Historical Response Violation, comprising nine specific subcategories. Next, we quantitatively evaluate six mainstream LLMs (i.e., GPT-4o, DeepSeek-Chat, Gemini 2.5, Qwen2.5-32B, Qwen2.5-72B, and Qwen3-235B-a22b) to analyze the distribution of Interaction Smells across different models. Finally, we propose Invariant-aware Constraint Evolution (InCE), a multi-agent framework designed to improve multi-turn interaction quality through explicit extraction of global invariants and pre-generation quality audits. Experimental results on the extended WildBench benchmark demonstrate that this lightweight mitigation approach significantly improves the Task Success Rate and effectively suppresses the occurrence of Interaction Smells.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。