arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2512.13914cs.SEcs.AIcs.HC

上下文分支用于LLM对话:一种版本控制方法用于探索性编程

Context Branching for LLM Conversations: A Version Control Approach to Exploratory Programming

Northeastern University(东北大学)

Bhargav Chickmagalur Nanjundappa, Spandan Maaheshwari

AI总结:

ContextBranch通过版本控制机制实现对话分支,解决多轮对话中上下文污染问题,提升探索性编程的响应质量和上下文意识。

摘要:

大型语言模型(LLMs)已成为软件工程工作流的重要组成部分,但它们在多轮对话中的效果显著下降。最近的研究表明,当指令跨多轮传递时,性能平均下降39%,模型会提前做出假设并无法及时纠正(Laban等,2025)。这种退化在探索性编程任务中尤为严重,因为开发者需要调查替代方法而不必坚持单一路径。当前的解决方案迫使用户陷入两难:继续在一个被污染的对话中,使LLM越来越困惑,或者重新开始并失去所有积累的上下文。我们提出了ContextBranch,一个对话管理系统,它将版本控制语义应用于LLM交互。ContextBranch提供了四个核心原语--检查点、分支、切换和注入,使用户能够捕获对话状态、在隔离环境中探索替代方案,并选择性地合并见解。我们通过一个受控实验评估ContextBranch,该实验包含30个软件工程场景,其中包含故意污染的探索。分支对话在响应质量上优于线性对话,大型改进体现在聚焦和上下文意识上。好处集中在复杂场景中涉及概念上遥远的探索。分支将上下文大小减少了58.1%(31.0到13.0条消息),消除了无关的探索性内容。我们的工作将对话分支确立为AI辅助探索性工作中的基本原语,证明了隔离在探索替代方案时可以防止上下文污染。

英文摘要:

Large Language Models (LLMs) have become integral to software engineering workflows, yet their effectiveness degrades significantly in multi-turn conversations. Recent studies demonstrate an average 39% performance drop when instructions are delivered across multiple turns, with models making premature assumptions and failing to course correct (Laban et al., 2025). This degradation is particularly problematic in exploratory programming tasks where developers need to investigate alternative approaches without committing to a single path. Current solutions force users into a false dichotomy: continue in a context-polluted conversation where the LLM becomes increasingly confused, or start fresh and lose all accumulated context. We present ContextBranch, a conversation management system that applies version control semantics to LLM interactions. ContextBranch provides four core primitives--checkpoint, branch, switch, and inject--enabling users to capture conversation state, explore alternatives in isolation, and selectively merge insights. We evaluate ContextBranch through a controlled experiment with 30 software engineering scenarios featuring intentionally polluting explorations. Branched conversations achieved higher response quality compared to linear conversations, with large improvements in focus and context awareness. Benefits were concentrated in complex scenarios involving conceptually distant explorations. Branching reduced context size by 58.1% (31.0 to 13.0 messages), eliminating irrelevant exploratory content. Our work establishes conversation branching as a fundamental primitive for AI-assisted exploratory work, demonstrating that isolation prevents context pollution when exploring alternatives.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑