Student or educator? Sign up with your school email and get 6 months of Pro free.
CoChat

The DOI matches its Crossref record; 94 of the 95 references it cites were found in a registry or an index, and 1 are not checked yet.

Toward a Theory of Causation for Interpreting Neural Code Models

Open access
Nader Palacio, David, Velasco, Alejandro, Cooper, Nathan, Rodriguez, Alvaro, Moran, Kevin, Poshyvanyk, Denys · 2024 · IEEE Transactions on Software Engineering

Abstract

Neural Language Models of Code, or Neural Code Models (NCMs), are rapidly progressing from research prototypes to commercial developer tools. As such, understanding the capabilities and limitations of such models is becoming critical. However, the abilities of these models are typically measured using automated metrics that often only reveal a portion of their real-world performance. While, in general, the performance of NCMs appears promising, currently much is unknown about how such models arrive at decisions. To this end, this paper introducesdocode, a post hoc interpretability method specific to NCMs that is capable of explaining model predictions.docodeis based upon causal inference to enable programming language-oriented explanations. While the theoretical underpinnings ofdocodeare extensible to exploring different model properties, we provide a concrete instantiation that aims to mitigate the impact of spurious correlations by grounding explanations of model behavior in properties of programming languages. To demonstrate the practical benefit ofdocode, we illustrate the insights that our framework can provide by performing a case study on two popular deep learning architectures and ten NCMs. The results of this case study illustrate that our studied NCMs are sensitive to changes in code syntax. All our NCMs, except for the BERT-like model, statistically learn to predict tokens related to blocks of code (e.g., brackets, parenthesis, semicolon) with less confounding bias as compared to other programming language constructs. These insights demonstrate the potential ofdocodeas a useful method to detect and facilitate the elimination of confounding bias in NCMs.

Overview

The claims and statistics of this paper haven’t been checked yet.

Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.

A few free checks a day · papers already verified open instantly · results are public

Integrity signals

Registry

Crossref · 10.1109/tse.2024.3379943

Cites

94 of 95 references verified0 citation errors · 0 not checkable

Statistics

Figures

Fig. 1 Common Cause Principle in NCMs [28]
Fig. 1 Common Cause Principle in NCMs [28]CC-BY-SA · From the PDF
Fig. 2 A classification of key methods in interpretability including Causal Interpretability .
Fig. 2 A classification of key methods in interpretability including Causal Interpretability .CC-BY-SA · From the PDF
Fig. 3 Ladder of Causation: do code is an extension of the intervention level.
Fig. 3 Ladder of Causation: do code is an extension of the intervention level.CC-BY-SA · From the PDF
Fig. 4 Spurious Correlation between the Number of Subwords common cause and Cross-Entropy values ( p ( Y | Z ) ≈ 0 . 87 ) for the ProgramRepair intervention generated from GPT2 6 , 12 .
Fig. 4 Spurious Correlation between the Number of Subwords common cause and Cross-Entropy values ( p ( Y | Z ) ≈ 0 . 87 ) for the ProgramRepair intervention generated from GPT2 6 , 12 .CC-BY-SA · From the PDF
Fig. 5 Overview of the do code Approach: Each numeral represents a step in the process of generating causal interpretations. First, a Structural Causal Model (SCM) that frames the explanation hypothesis is formulated. Second, do code executes graph surgery on the SCM to isolate a targeted estimand of the causal effect. Third, the causal effect is assessed based on the targeted estimand. Finally, the estimated effect and the SCM are scrutinized through refutation techniques and exploratory analysis to confirm their validity.
Fig. 5 Overview of the do code Approach: Each numeral represents a step in the process of generating causal interpretations. First, a Structural Causal Model (SCM) that frames the explanation hypothesis is formulated. Second, do code executes graph surgery on the SCM to isolate a targeted estimand of the causal effect. Third, the causal effect is assessed based on the targeted estimand. Finally, the estimated effect and the SCM are scrutinized through refutation techniques and exploratory analysis to confirm their validity.CC-BY-SA · From the PDF
Fig. 6 (a) Structural Causal Model representing cause-effect relationships of program repair in NCMs. (b) The SCM after intervening the treatment with Fixed Code .
Fig. 6 (a) Structural Causal Model representing cause-effect relationships of program repair in NCMs. (b) The SCM after intervening the treatment with Fixed Code .CC-BY-SA · From the PDF
Fig. 7 Potential Outcomes are Code Prediction of NCMs: Cross-Entropy ( Y g ) , Next Token Predictions ( Y l ) , or Distance metrics ( Y d ) .
Fig. 7 Potential Outcomes are Code Prediction of NCMs: Cross-Entropy ( Y g ) , Next Token Predictions ( Y l ) , or Distance metrics ( Y d ) .CC-BY-SA · From the PDF
Image 8
CC-BY-SA · From the PDF
Fig. 9 Configuration criteria for enabling causal interpretability. Seven scenarios are proposed for this case study. However, new interpretability cases can be formulated using a different permutation or extending the criteria.
Fig. 9 Configuration criteria for enabling causal interpretability. Seven scenarios are proposed for this case study. However, new interpretability cases can be formulated using a different permutation or extending the criteria.CC-BY-SA · From the PDF
Fig. 10 Structural Causal Models' Definition. Each SCM presents the causal estimand, the potential outcomes, the intervention type, and examples of interventions for each interpretability scenario.
Fig. 10 Structural Causal Models' Definition. Each SCM presents the causal estimand, the potential outcomes, the intervention type, and examples of interventions for each interpretability scenario.CC-BY-SA · From the PDF
Fig. 11 Code Syntax Clustering. Code predictions are grouped into Keyword-based or AST/Grammar-based categories.
Fig. 11 Code Syntax Clustering. Code predictions are grouped into Keyword-based or AST/Grammar-based categories.CC-BY-SA · From the PDF
Fig. 12 SyntacticDifferences Intervention ( BigClone3TB ) for Global Performance: Bootstrapped Cross-Entropy. Top Left: RNN 1 , 1024 ( JS = 0 . 3 ), Top Right: GRU 1 , 1024 ( JS = 0 . 8 ), Bot Left: GPT-2 6 , 12 ( JS = 0 . 6 ), Bot Right: GPT-2 12 , 12 ( JS = 1 ).
Fig. 12 SyntacticDifferences Intervention ( BigClone3TB ) for Global Performance: Bootstrapped Cross-Entropy. Top Left: RNN 1 , 1024 ( JS = 0 . 3 ), Top Right: GRU 1 , 1024 ( JS = 0 . 8 ), Bot Left: GPT-2 6 , 12 ( JS = 0 . 6 ), Bot Right: GPT-2 12 , 12 ( JS = 1 ).CC-BY-SA · From the PDF
Fig. 13 Descriptive Error Analysis. Keyword-Based Categories probabilities (Normalized Y l - NTP) for GPT-2 6 , 12 RNN 1 , 1024 and GRU 1 , 1024 on the BuggyTB dataset. Higher values indicate less erroneous predictions.
Fig. 13 Descriptive Error Analysis. Keyword-Based Categories probabilities (Normalized Y l - NTP) for GPT-2 6 , 12 RNN 1 , 1024 and GRU 1 , 1024 on the BuggyTB dataset. Higher values indicate less erroneous predictions.CC-BY-SA · From the PDF
Fig. 14 Frequency analysis of keyword-based categories by NCM.
Fig. 14 Frequency analysis of keyword-based categories by NCM.CC-BY-SA · From the PDF
Image 15
CC-BY-SA · From the PDF
Image 16
CC-BY-SA · From the PDF
Image 17
CC-BY-SA · From the PDF
Image 18
CC-BY-SA · From the PDF
Image 19
CC-BY-SA · From the PDF
Image 20
CC-BY-SA · From the PDF

Verification

Claims the paper makes

The claims and statistics of this paper haven’t been checked yet.

Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.

A few free checks a day · papers already verified open instantly · results are public

Claims other papers make about this one

Each is checked against this paper’s own text: does it say what the citing paper says it does?

Self-check

Percentages, sums and reported differences re-computed from the paper’s own numbers.

The self-check needs the paper’s full text.

Citations

Cites

Show all 86 references

Research works printed but not linked: 4

  1. 10.1145/3510457.3513081 · doi:10.1145/3510457.3513081
  2. Hu, 2022, Neuron dependency graphs: A causal abstraction of neural networks, 162, 9020
  3. 10.5555/3454287.3455008 · doi:10.5555/3454287.3455008
  4. Karampatsis, 2020, Big code != big vocabulary: Open-vocabulary models for source code, 1073

Cited by

See all 30

Metadata

Authors
Nader Palacio, D., Velasco, A., Cooper, N., Rodriguez, A., Moran, K., & Poshyvanyk, D.
Affiliations
  • Department of Computer Science, William & Mary, Williamsburg, VA, USA
  • William & Mary (US)
  • Department of Computer Science, Universidad Nacional de Colombia, Bogota, Colombia
  • George Mason University (US)
Venue
IEEE Transactions on Software Engineering
Published
2024-05
Volume
50
Issue
5
Pages
1215-1243
ISSN
  • 0098-5589 (ISSN-L)
  • 1939-3520
  • 2326-3881
OpenAlex
W4393058215
Cited by
18
References
86
Citations by year
2026: 3 · 2025: 8 · 2024: 5
FWCI
2.36
Type
journal article
Language
en
Open access
Locations
  • IEEE Transactions on Software Engineering (publishedVersion)
  • arXiv (Cornell University) (submittedVersion, cc-by-sa)
  • arXiv (Cornell University)
Funders
NSF (CCF-2311469, CNS-2132281, CCF-2007246, CCF-1955853, CCF-2311468, CCF-2132285)
Topics
  • Physical Sciences › Computer Science › Artificial Intelligence › Explainable Artificial Intelligence (XAI)
  • Physical Sciences › Computer Science › Information Systems › Software Engineering Research
  • Physical Sciences › Computer Science › Software › Software Testing and Debugging Techniques
Keywords
post-hoc explanation, causal inference, confounding, spurious correlations, programming constructs, token prediction

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review

How to cite

Cite CoChat for the checks on this page, and the paper for its own findings.

This page
CoChat. (2026). Citation check: Toward a Theory of Causation for Interpreting Neural Code Models. https://app.cochat.ai/papers/10.1109/tse.2024.3379943
The paper
Nader Palacio, D., Velasco, A., Cooper, N., Rodriguez, A., Moran, K., & Poshyvanyk, D. (2024). Toward a Theory of Causation for Interpreting Neural Code Models. IEEE Transactions on Software Engineering. https://doi.org/10.1109/tse.2024.3379943

Data sources

Bibliographic data: Semantic Scholar, OpenAlex, Crossref.

Contains information from the Semantic Scholar Academic Graph Datasets, made available under the ODC Attribution License (ODC-BY 1.0).

Semantic Scholar’s data is described in: Kinney, R., et al. (2023). The Semantic Scholar Open Data Platform. arXiv:2301.10140.