Reproduce “Understanding How CodeLLMs (Mis)Predict Types with Activation Steering” on OpenResearch

Turn your favorite coding agents into research agents that review literature, develop hypotheses, and run experiments.

Universal app for Apple silicon and Intel. Requires macOS 11 or later.

About this paper

Francesca Lucchetti, Arjun Guha

Researchers from Northeastern University probed the internal mechanisms of CodeLLMs, revealing that these models possess a robust, latent understanding of program semantics for type prediction despite exhibiting fragility to syntactic changes. Their activation steering technique, applied at inference time, successfully restored type prediction accuracy by 50-80% on adversarially constructed inputs and demonstrated cross-language transferability of the learned semantic mechanism.

Key insights

  • CodeLLMs learn robust internal mechanisms for type prediction, but these mechanisms are often not activated when programs contain adversarial syntactic features.
  • The robust type prediction mechanism is primarily localized within the later middle layers of the transformer architecture and spans multiple adjacent layers.
  • A shared, language-agnostic representation of type systems exists, as demonstrated by the successful cross-language transferability of steering vectors between Python and TypeScript.

Summary by alphaXiv.

Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.