Metaphor-Induced Algorithmic Steering: Cross-Domain Procedural Transfer in LLM Code Generation
- URL: http://arxiv.org/abs/2607.28683v1
- Date: Thu, 30 Jul 2026 02:07:01 GMT
- Title: Metaphor-Induced Algorithmic Steering: Cross-Domain Procedural Transfer in LLM Code Generation
- Abstract summary: We show that metaphorical instructions can induce analogical transfer of procedural mechanisms.<n>We develop MASC, a framework that iteratively metaphorizes and refines benign skills to elicit low-efficiency code.
- Score: 11.514477267634225
- License: http://creativecommons.org/licenses/by/4.0/
- Abstract: 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.
Related papers
- Transformer See, Transformer Do: Copying as an Intermediate Step in Learning Analogical Reasoning [2.1424510747711314]
We train transformers using Meta-Learning for Compositionality (MLC) on an analogical reasoning task.<n>We find that letter-string analogies become learnable when guiding the models to attend to the most informative problem elements.<n>Our 3-layer encoder-decoder model outperforms most frontier models.
arXiv Detail & Related papers (2026-04-07T22:15:56Z) - Executable Ontologies in Game Development: From Algorithmic Control to Semantic World Modeling [51.56484100374058]
We argue that Executable Ontologies (EO) represent a transition from algorithmic behavior programming to semantic world modeling.<n>We show how EO achieves prioritybased task interruption through dataflow conditions rather than explicit preemption logic.
arXiv Detail & Related papers (2026-01-12T19:57:35Z) - Weights to Code: Extracting Interpretable Algorithms from the Discrete Transformer [65.38883376379812]
We propose the Discrete Transformer, an architecture engineered to bridge the gap between continuous representations and discrete symbolic logic.<n> Empirically, the Discrete Transformer not only achieves performance comparable to RNN-based baselines but crucially extends interpretability to continuous variable domains.
arXiv Detail & Related papers (2026-01-09T12:49:41Z) - Taming Imperfect Process Verifiers: A Sampling Perspective on Backtracking [54.43083499412643]
Test-time algorithms that combine the generative power of language models with process verifiers offer a promising lever for eliciting new reasoning capabilities.<n>We introduce a new process-guided test-time sampling algorithm, VGB, which uses theoretically grounded backtracking to achieve provably better robustness to verifier errors.
arXiv Detail & Related papers (2025-10-03T16:21:14Z) - Tracr-Injection: Distilling Algorithms into Pre-trained Language Models [2.532202013576547]
We propose tracr-injection, a method that allows us to distill algorithms written in RASP directly into a pre-trained language model.<n>We show how our method creates an interpretable subspace within the model's residual stream, which can be decoded into the variables present in the RASP algorithm.
arXiv Detail & Related papers (2025-05-15T21:43:51Z) - Learning Task Representations from In-Context Learning [67.66042137487287]
Large language models (LLMs) have demonstrated remarkable proficiency in in-context learning (ICL)<n>We introduce an automated formulation for encoding task information in ICL prompts as a function of attention heads.<n>The proposed method successfully extracts task-specific information from in-context demonstrations and excels in both text and regression tasks.
arXiv Detail & Related papers (2025-02-08T00:16:44Z) - Unified Generative and Discriminative Training for Multi-modal Large Language Models [88.84491005030316]
Generative training has enabled Vision-Language Models (VLMs) to tackle various complex tasks.
Discriminative training, exemplified by models like CLIP, excels in zero-shot image-text classification and retrieval.
This paper proposes a unified approach that integrates the strengths of both paradigms.
arXiv Detail & Related papers (2024-11-01T01:51:31Z) - PSSAT: A Perturbed Semantic Structure Awareness Transferring Method for
Perturbation-Robust Slot Filling [27.602336774468]
Most existing slot filling models tend to memorize inherent patterns of entities and corresponding contexts from training data.
We propose a semantic awareness structure transferring method for training perturbation-robust slot filling models.
arXiv Detail & Related papers (2022-08-24T13:01:00Z) - AutoProtoNet: Interpretability for Prototypical Networks [0.0]
We introduce AutoProtoNet, which builds interpretability into Prototypical Networks.
We demonstrate how points in this embedding space can be visualized and used to understand class representations.
We also devise a prototype refinement method, which allows a human to debug inadequate classification parameters.
arXiv Detail & Related papers (2022-04-02T19:42:03Z) - Transductive Learning for Unsupervised Text Style Transfer [60.65782243927698]
Unsupervised style transfer models are mainly based on an inductive learning approach.
We propose a novel transductive learning approach based on a retrieval-based context-aware style representation.
arXiv Detail & Related papers (2021-09-16T08:57:20Z) - On Contrastive Representations of Stochastic Processes [53.21653429290478]
Learning representations of processes is an emerging problem in machine learning.
We show that our methods are effective for learning representations of periodic functions, 3D objects and dynamical processes.
arXiv Detail & Related papers (2021-06-18T11:00:24Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.