arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~

隐喻诱导的算法引导:LLM代码生成中的跨领域过程迁移

Metaphor-Induced Algorithmic Steering: Cross-Domain Procedural Transfer in LLM Code Generation

Zhibo Hu, Chen Wang, Yanfeng Shu, Hye-young Paik, Liming Dong, Liming Zhu

arXiv 2607.28683首次发表:更新:

发表机构

The University of New South Wales; CSIRO(新南威尔士大学; 联邦科学与工业研究组织)

机构由 AI 辅助整理,请以论文原文为准。

AI 中文总结

本研究提出MASC框架,发现隐喻会诱导LLM代码生成模型迁移低效率过程模式,可高检测率识别此类隐喻技能与低效率实现,揭示其通过源场景过程模式迁移运作的机制。

AI 中文摘要

大型语言模型从自然语言元素(如训练数据和推理输入中的隐喻与类比)中获益,以实现跨不同领域的泛化性。然而,这些语言元素也可能导致不当行为,因为隐喻表达会将不合适的过程模式隐性迁移到新任务中。本文中,我们表明隐喻指令可诱导过程机制的类比迁移,从而引导代码生成模型采用效率较低的算法。我们将这种隐喻诱导效应称为隐喻算法引导:源领域中良性且合理的技能会将抽象过程模式迁移到编程任务中,使模型倾向于穷举搜索、全扫描或重复重构,而不明确提及目标算法。更广泛地说,这表明代码生成模型可将任务背景领域中合适的过程带入任务的编程问题,从而导致不良结果。为研究该现象,我们开发了MASC(Metaphorical Algorithmic Steering for Code Generation)框架,该框架通过迭代地将良性技能隐喻化并优化,以引出低效率代码,同时保持良性且与任务相关。除行为评估外,我们还研究该现象是否可检测且在模型表征中具有机械反映。我们的方法对隐喻技能和低效率实现实现了高检测率,还发现隐喻技能会诱导隐藏状态向低效率过程行为原型转变。这些结果表明,隐喻算法引导通过迁移与隐喻源场景相关的过程模式运作,而非仅通过表层隐喻语言。

英文摘要

Large language models benefit from elements in natural language, such as metaphors and analogies in training data and inference input to achieve generalisability across different domains. However, these language elements may also lead to unwanted behaviors when metaphorical expressions implicitly transfer inappropriate procedural patterns into new tasks. In this paper, we show that metaphorical instructions can induce analogical transfer of procedural mechanisms, thus steering code-generation models towards less efficient algorithms. We refer to this metaphor-induced effect as metaphorical algorithmic steering: a skill that is benign and plausible within its source domain transfers an abstract procedural schema into a programming task, causing the model to favor exhaustive search, full scans, or repeated reconstruction without explicitly mentioning the target algorithm. More broadly, this suggests that code-generation models can carry procedures that are appropriate in a task's background domain into the task's programming problem, where they can lead to unwanted outcomes. To study this phenomenon, we develop MASC (Metaphorical Algorithmic Steering for Code Generation), a framework that iteratively metaphorizes and refines benign skills to elicit low-efficiency code while remaining benign and task-relevant. Beyond behavioral evaluation, we study whether this phenomenon is detectable and mechanistically reflected in model representations. Our method achieves high detection rates for metaphorical skills and less-efficient implementations. We also find that metaphorical skills induce a hidden-state shift towards lower-efficiency procedural behavior prototypes. These results suggest that metaphorical algorithmic steering operates through the transfer of procedural patterns associated with metaphorical source scenarios rather than surface level metaphorical language alone.

Comments12 pages, 11 tables, 4 figures

论文原文

arXiv 摘要页 · PDF 原文 · HTML 原文

↑