← News

Models & toolsSources: arXiv · 1 Dec 2026

Code models copy nearby stubs when deciding whether to fill code or leave a skeleton

An arXiv study finds that completion-style code models judge whether a function is a solution or an exercise by their surroundings, often copying a neighbour's placeholder instead of writing code.

In plain words

When a function has a signature but no body, a code model must guess whether to write an implementation or leave a placeholder such as "pass". Researchers found the model decides by looking at the rest of the file, especially nearby functions. This helps in exercise files but can wrongly insert placeholders into real code.

What was announced

The study, an arXiv abstract, examined 24 openly available models completing Python functions whose bodies were empty. When the surrounding document looked like a coding exercise, models tended to emit a deferral opener such as "pass" or a raised exception rather than an implementation. A neighbouring function strongly influenced this choice: models reproduced its exact stub form rather than picking a different one. Where no neighbour existed, file-level text served as a genre signal, and altering a single word in a file path changed deferral behaviour across 23 comparable models.

The authors report a trade-off. On real GitHub files, models matched the files' own rate of skeleton-style neighbours, yet the same cue increased false deferrals on genuine code from 0.5% to 7.1%. Mechanistic analysis pointed to a late comment-versus-code decision and a distributed reader-writer circuit. The team also describe representation-level interventions that beat coarse comment bans by 8.5 and 5.5 percentage points in two instruction-tuned HumanEval settings, while avoiding failures caused by suppressing helpful comments. They note the behaviour appears only with completion-style prompting and vanishes when a chat template allows free-form answers.

What it does not show

  • The evidence is an abstract only; full methods, model lists and results are not available for verification.
  • The reported gains come from two instruction-tuned HumanEval settings and may not transfer to other benchmarks or production use.
  • The abstract is truncated, so the full GitHub-file result is incomplete.

Sources

Source-support review completed 5 Dec 2026. This story was drafted with AI assistance and checked against retained source passages. Automated checking is not independent verification.

Coverage: arXiv: abstract.

Updates and corrections

No corrections so far.

First published 5 Dec 2026

New to the subject? AI from the Ground Up starts from the beginning.