Large Language Models (LLMs) are widely used by software engineers for programming tasks. However, research shows that LLMs often lack a deep understanding of program semantics. Even minor changes to syntax, such as renaming variables, can significantly degrade performance across various tasks. In this work, we examine the task of type prediction: given a partially typed program, can a model predict a missing type annotations such that the resulting program is more typed? We construct a dataset of adversarial examples where models initially predict the correct types, but begin to fail after semantically irrelevant edits. This is problematic, as models should ideally generalize across different syntactic forms of semantically equivalent code. This lack of robustness suggests that models may have a shallow understanding of code semantics. Despite this, we provide evidence that LLMs do, in fact, learn robust mechanisms for type prediction-though these mechanisms often fail to activate in adversarial scenarios. By using activation steering, a method that manipulates a model's internal activations to guide it toward using latent knowledge, we restore accurate predictions on adversarial inputs. We show that steering successfully activates a type prediction mechanism that is shared by both Python and TypeScript, and is more effective than prompting with in-context examples. Across five different models, our comprehensive evaluation demonstrates that LLMs can learn generalizable representations of code semantics that transfer across programming languages.
Teaching Code LLMs to Reason with Intermediate Formal Specifications
FPT Software AI Center(FPT软件人工智能中心);University of Texas at Dallas(德克萨斯大学达拉斯分校);Hanoi Univ. of Science and Tech.(河内科学技术大学);Texas, USA(得克萨斯州,美国);Hanoi, Vietnam(河内,越南)
Do Personality Traits Interfere? Geometric Limitations of Steering in Large Language Models
Network Analysis and Social Influence Modelling (NASIM) Lab(网络分析与社会影响建模实验室);School of Physics Maths and Computing(物理数学计算学院);The University of Western Australia(西澳大学);School of Computing(计算学院);Macquarie University(麦觉瑞大学)
CoSToM:Causal-oriented Steering for Intrinsic Theory-of-Mind Alignment in Large Language Models
National Engineering Research Center for Big Data Technology and System, Services Computing Technology and System Lab, Cluster and Grid Computing Lab, Huazhong University of Science and Technology(华中科技大学国家大数据技术与系统工程技术研究中心、服务计算技术与系统实验室、集群与网格计算实验室);Singapore Management University(新加坡管理大学)
Interpretable LLM Guardrails via Sparse Representation Steering
The State Key Laboratory of Blockchain and Data Security, Zhejiang University, China(区块链与数据安全国家重点实验室,浙江大学,中国);School of Cyber Science and Technology, Zhejiang University, China(网络安全与技术学院,浙江大学,中国);College of Computer and Information Sciences, Fujian Agriculture and Forestry University, China(计算机与信息科学学院,福建农林大学,中国)
LLMs Silently Correct African American English: Auditing and Mitigating Dialect Bias via Activation Steering
York University(约克大学);Vector Institute(向量研究所);Connected Minds(连接思维公司);Emory University(埃默里大学);Wilfrid Laurier University(威尔弗里德·劳里埃大学);University of Toronto(多伦多大学);University of Guelph(圭尔夫大学);Monark Health(莫纳克健康公司);CIFAR Solution Network(加拿大高级研究院解决方案网络)
CogSteer: Cognition-Inspired Selective Layer Intervention for Efficiently Steering Large Language Models
Department of Informatics, Universität Hamburg(汉堡大学信息学院);The University of Sydney(悉尼大学);Alibaba International Digital Commerce(阿里巴巴国际数字商业);Institute of Psychology, Chinese Academy of Sciences(中国科学院心理研究所)