Saved in:
Bibliographic Details
Main Authors: Rahman, Md Mahbubur, Guha, Arjun, Menon, Harshitha
Format: Preprint
Published: 2026
Subjects:
Online Access:https://arxiv.org/abs/2603.23629
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866911547194867712
author Rahman, Md Mahbubur
Guha, Arjun
Menon, Harshitha
author_facet Rahman, Md Mahbubur
Guha, Arjun
Menon, Harshitha
contents Code LLMs often default to particular programming languages and libraries under neutral prompts. We investigate whether these preferences are encoded as approximately linear directions in activation space that can be manipulated at inference time. Using a difference-in-means method, we estimate layer-wise steering vectors for five language/library pairs and add them to model hidden states during generation. Across three open-weight code LLMs, these interventions substantially increase generation toward the target ecosystem under neutral prompts and often remain effective even when prompts explicitly request the opposite choice. Steering strength varies by model and target, with common ecosystems easier to induce than rarer alternatives, and overly strong interventions can reduce output quality. Overall, our results suggest that code-style preferences in LLMs are partly represented by compact, steerable structure in activation space.
format Preprint
id arxiv_https___arxiv_org_abs_2603_23629
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Steering Code LLMs with Activation Directions for Language and Library Control
Rahman, Md Mahbubur
Guha, Arjun
Menon, Harshitha
Machine Learning
Code LLMs often default to particular programming languages and libraries under neutral prompts. We investigate whether these preferences are encoded as approximately linear directions in activation space that can be manipulated at inference time. Using a difference-in-means method, we estimate layer-wise steering vectors for five language/library pairs and add them to model hidden states during generation. Across three open-weight code LLMs, these interventions substantially increase generation toward the target ecosystem under neutral prompts and often remain effective even when prompts explicitly request the opposite choice. Steering strength varies by model and target, with common ecosystems easier to induce than rarer alternatives, and overly strong interventions can reduce output quality. Overall, our results suggest that code-style preferences in LLMs are partly represented by compact, steerable structure in activation space.
title Steering Code LLMs with Activation Directions for Language and Library Control
topic Machine Learning
url https://arxiv.org/abs/2603.23629