TRANSMISSION // 2611.28153v1

Why AI-written code can look right—and still need repair

Source published

A software-engineering thesis combines studies of code in use, real-world generation tests and AI-code detection to motivate tracing the internal decisions behind defects. Its proposed repair method remains future work.

AI-generated conceptual illustration for Why AI-written code can look right—and still need repair
AI-generated conceptual illustration; not documentary evidence.

AI-generated code can be hard to distinguish from human code and still require correction after it enters a project. Musfiqur Rahman’s thesis brings together evidence about code in use, benchmark performance and detection, then argues that tracing a model’s internal computations could help explain defects. That tracing and the proposed repair framework are not yet complete.

Large language models can produce code that looks plausible, resembles human-written code in some measurements and passes an initial review. But does that mean the code works reliably—and, when it fails, can researchers discover why? Musfiqur Rahman’s thesis, From Observation to Explanation, brings together studies of software repositories, code-generation tests and AI-code detection to make the case for investigating models’ internal computations. Its central proposal is to use that investigation to guide repairs at the source of a defect, rather than repeatedly patching the visible code.

The thesis follows three strands of evidence. First, it examines how code attributed to different kinds of AI assistance changes over time in open-source projects. The analysis covers 223,997 line-level and 61,729 hunk-level units across 156 repositories. Using survival analysis, the author compares how soon code is modified under two definitions: any textual change, and a structural change measured through abstract syntax trees, or ASTs.

The results differ by collaboration type. Code attributed to pair-programming assistants and batch generators had lower modification risk than the human-written baseline under both definitions. For autonomous-agent code, the structural measure did not show a statistically significant difference from human code (hazard ratio 1.019; p = 0.490). Yet the study reports that a larger share of modifications to autonomous-agent code were classified as corrective: 49.1%, compared with 37.9% for the human baseline. The author also reports that agent-orphaned files were modified more often than co-owned files, contrary to the idea that developers simply avoid maintaining them.

These observations do not establish that autonomous agents caused the corrections, or identify what went wrong in each case. They point to a question the repository analysis cannot answer on its own: what in the generation process might produce code that later needs fixing?

The second strand tests whether results on artificial programming exercises reflect performance on real software. On a benchmark of 400 Python classes from open-source repositories, seven models achieved 24–35% correctness, compared with 84–89% on a synthetic class-generation benchmark. Performance on repositories classified as seen or unseen relative to model training cutoffs was statistically indistinguishable, according to the thesis. The author interprets this as evidence that the performance gap is not explained by memorization alone. In a separate error analysis, AttributeError, TypeError and AssertionError together accounted for 84% of failures. These are test findings for the studied tasks, not a universal estimate of how often AI-written code fails.

The third strand asks whether generated code can be identified by its structure. In a study of Python functions and classes generated by four models, GPT-3.5 was especially detectable at the function level, with an AUC-ROC of 0.96. AUC-ROC summarizes how well a classifier separates two groups across decision thresholds; it is not the same as the proportion of all AI code correctly flagged. The commercial detector GPTZero had reported recall ranging from 15% to 64% across the tested model and code-size settings. No single feature reliably separated generated from human-written code at the class level. The results caution against treating any detector as a dependable judge of authorship in every context.

Together, these studies describe patterns, not their internal causes. The thesis proposes mechanistic interpretability—examining which components of a transformer model contribute to particular output choices—as a way to investigate that gap. Its methods include logit lens analysis, which tracks how token predictions develop across layers, and activation patching, which swaps internal activations between runs to test whether a component affects a particular prediction. A preliminary experiment in two small code models suggests that choices between library aliases can depend on context-retrieval circuits. This is a limited pilot, not evidence that the same explanation applies to all coding models or defects.

Crucially, the thesis’s proposed agentic repair framework is planned work. It would use circuit-level findings to guide interventions and assess whether they reduce defects while preserving correctness. The paper does not report a completed evaluation showing that this approach repairs code better than existing methods. The author also flags risks: results from small open-weight models may not transfer to larger proprietary systems, circuit findings may vary with prompts or model settings, and training-data contamination cannot be ruled out with certainty.

The source is a short thesis paper associated with EASE ’26; it combines completed empirical studies with ongoing interpretability research and a planned repair phase. Some underlying studies are described as under review or in preparation. Its reported findings should therefore be read in that context, and the proposed causal explanations and repair benefits remain research questions—not established outcomes.

Reviewed cross-references

These connections were reviewed by a model, not independently fact-checked by a human. Similarity does not imply agreement; consult the original papers and the evidence below.

  • How a tiny particle exposed a flaw in a physics AI

    Shared method: Both papers use activation patching to test which internal components causally affect a model output: the origin describes substituting activations to investigate code-generation decisions, while the target patches attention-head outputs to measure their contribution to jet-classification changes. This is a methodological parallel, not evidence that the identified circuits or findings transfer between code models and a particle-physics model.

    Model review: · openai-codex/gpt-6-luna

    Evidence and provenance

    Selected excerpts, not complete papers. PDF extraction can omit figures or damage equations, tables and reading order; sources may be preprints.

    • 2611.28153v1 — Original paper

      Excerpt reference: static/papers/2611.28153v1.md:502-556
      Basis: Paper text
      Source SHA-256: e76ac81aaa27e4e16d4b46fecc8a8511612a017384ee2274f4e6cf5ea7515630

    • 2611.27079v1 — Original paper

      Excerpt reference: static/papers/2611.27079v1.md:238-383
      Basis: Paper text
      Source SHA-256: 115b9dc6070fe9172c2022581ac06e3ba49d50beb55d2f1274edde4bc3624b45

Automatically matched by shared topic keywords. These links do not imply that the sources agree or establish a consensus.