Solution or Skeleton? Distributional Alignment and Mode Switching in Code Language Models
Abstract
A Python signature with a docstring and an empty body can open a solution file or an exercise skeleton. We show that code language models resolve this ambiguity from the surrounding document and, when it resembles a skeleton, emit a \emph{deferral opener}---\ph{}, \code{pass}, or \code{raise NotImplementedError}---instead of code. Across 24 open models, a neighbouring function can decide the choice: models copy its exact stub form rather than substitute another. With nothing to copy, file-level text acts as a genre cue, and changing one word in a path raises deferral on every one of 23 comparable models. In real GitHub files, models follow skeleton neighbours at the files' own rate, but the same cue raises false deferral on real code from to . Mechanistic analyses locate a late comment--code decision and a distributed reader--writer circuit. Building on this structure, we introduce representation-level interventions that outperform coarse comment bans by and \pp{} in two instruction-tuned HumanEval settings, while avoiding failures caused by suppressing useful comments. The behaviour is specific to completion-style prompting and disappears under a chat template with free answers.
Create a lesson
Metadata
- Categories
- cs.SE, cs.AI
Related papers
Escalate on Failure: A Single-Model Mode-Switching Cascade for Local Code Generation
Shared title terminologycs.SEBrian K. Hudes
Codit-Bench - Can Large Language Models Find Bugs in Code Auditing?
Shared title terminologycs.SEYuesong Feng, Zheng Zhang, Haoran Ding et al.
Understanding and Mitigating Representation Drift of Code Models under Software Distribution Shifts
Shared title terminologycs.SEYiqing Shi, Zhifei Chen, Yangyang Zhao et al.
Evaluating Code Slop in Long-Horizon Coding Agents
Shared title terminologycs.SEShubham Gandhi, Shyam Agarwal, Nachiket Kotalwar et al.
ReleaseSynth: Scaling Data from Software Evolution for Long-Horizon Coding Agents
Shared title terminologycs.SEMan Ho Lam, Chaozheng Wang, Zongjie Li et al.
Managing Specification. Not code: A feasibility study of Graph -> Contract -> Code Deployment and Maintenance
Shared title terminologycs.SEHenry Yeung