Looking into Black Box Code Language Models
Not on the map. Why?
Abstract (arXiv)
Language Models (LMs) have shown their application for tasks pertinent to code and several code~LMs have been proposed recently. The majority of the studies in this direction only focus on the improvements in performance of the LMs on different benchmarks, whereas LMs are considered black boxes. Besides this, a handful of works attempt to understand the role of attention layers in the code~LMs. Nonetheless, feed-forward layers remain under-explored which consist of two-thirds of a typical transformer model's parameters. In this work, we attempt to gain insights into the inner workings of code language models by examining the feed-forward layers. To conduct our investigations, we use two state-of-the-art code~LMs, Codegen-Mono and Ploycoder, and three widely used programming languages, Java, Go, and Python. We focus on examining the organization of stored concepts, the editability of these concepts, and the roles of different layers and input context size variations for output generation. Our empirical findings demonstrate that lower layers capture syntactic patterns while higher layers encode abstract concepts and semantics. We show concepts of interest can be edited within feed-forward layers without compromising code~LM performance. Additionally, we observe initial layers serve as ``thinking'' layers, while later layers are crucial for predicting subsequent code tokens. Furthermore, we discover earlier layers can accurately predict smaller contexts, but larger contexts need critical later layers' contributions. We anticipate these findings will facilitate better understanding, debugging, and testing of code~LMs.
Key facts. Cited by 5 papers in the map (data through 7 Oct 2026). Builds on 29 of its 42 references that are in the map. First posted on arXiv 5 Jul 2024.
Builds on
29 of 42 references.
References · 29
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,530
- 2020The Pile: An 800GB Dataset of Diverse Text for Language Modelingcited by 2,346
- 2020Transformer Feed-Forward Layers Are Key-Value Memoriescited by 1,307
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2023Large Language Models Cannot Self-Correct Reasoning Yetcited by 965
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
17 more
- 2022GPT-NeoX-20B: An Open-Source Autoregressive Language Modelcited by 711
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
- 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 417
- 2021Unified Pre-training for Program Understanding and Generationcited by 361
- 2022A Systematic Evaluation of Large Language Models of Codecited by 360
- 2016Understanding Neural Networks through Representation Erasurecited by 223
- 2022Grounded Copilot: How Programmers Interact with Code-Generating Modelscited by 216
- 2020Analyzing Individual Neurons in Pre-trained Language Modelscited by 97
- 2019The emergence of number and syntax units in LSTM language modelscited by 92
- 2019Augmenting Self-attention with Persistent Memorycited by 92
- 2022What Do They Capture? -- A Structural Analysis of Pre-Trained Language Models for Source Codecited by 50
- 2023Exploring the Potential of ChatGPT in Automated Code Refinement: An Empirical Studycited by 44
- 2023On the Reliability and Explainability of Language Models for Program Generationcited by 17
- 2021Practitioners' Perceptions of the Goals and Visual Explanations of Defect Prediction Modelscited by 9
- 2022Explainable AI for Pre-Trained Code Models: What Do They Learn? When They Do Not Work?cited by 8
- 2023Evaluating Neuron Interpretation Methods of NLP Modelscited by 8
- 2020Comprehensive Online Network Pruning via Learnable Scaling Factorscited by 7
Built on by
Citing papers per year: 2025: 4; 2026: 1.
5 papers.
- 2025How Programming Concepts and Neurons Are Shared in Code Language Modelscited by 4
- 2025Neuron-Guided Interpretation of Code LLMs: Where, Why, and How?cited by 3
- 2026On the Persistent Effects of Lexicality in Large Language Modelscited by 1
- 2025Decoupling Knowledge and Reasoning in Transformers: A Modular Architecture with Generalized Cross-Attentioncited by 0
- 2025Toward Neurosymbolic Program Comprehensioncited by 0
- 2026On the Persistent Effects of Lexicality in Large Language Models1 Jun 2026
- 2025Neuron-Guided Interpretation of Code LLMs: Where, Why, and How?23 Dec 2025
- 2025How Programming Concepts and Neurons Are Shared in Code Language Models1 Jun 2025
- 2025Toward Neurosymbolic Program Comprehension3 Feb 2025
- 2025Decoupling Knowledge and Reasoning in Transformers: A Modular Architecture with Generalized Cross-Attention1 Jan 2025