Built independently by an author, for readers. Read the story and support ChapterPal

keyword

abstract syntax tree

An abstract syntax tree is a hierarchical tree representation of the syntactic structure of source code written in a programming language. Each node in the tree corresponds to an operator, statement, expression, or other language construct, while the branches represent how these constructs logically nest and interact according to the formal grammar of the language. Unlike concrete parse trees, an abstract syntax tree omits superficial syntactic details such as whitespace, commas, semicolons, and grouping parentheses, preserving only the essential structural relationships needed for interpretation and analysis. This structured format serves as an intermediate representation widely utilized by compilers, interpreters, static analysis tools, and code intelligence systems to perform semantic validation, optimization, transformation, and automated program analysis.

2 items

UniXcoder: Unified Cross-Modal Pre-training for Code Representation

UniXcoder: Unified Cross-Modal Pre-training for Code Representation

Daya Guo, Shuai Lu, Nan Duan, Yanlin Wang, Ming Zhou, Jian Yin

OrganizationsLangboat TechnologyMicrosoftSun Yat-sen University

Why you should read this

Presents a unified cross-modal pre-trained model that integrates source code, natural language comments, and linearized abstract syntax trees using prefix adapters and contrastive learning to support code understanding, generation, and completion tasks.

Pre-trained models for programming languages have recently demonstrated great success on code intelligence. To support both code-related understanding and generation tasks, recent works attempt to pre-train unified encoder-decoder models. However, such encoder-decoder framework is sub-optimal for auto-regressive tasks, especially code completion that requires a decoder-only manner for efficient inference. In this paper, we present UniXcoder, a unified cross-modal pre-trained model for programming language. The model utilizes mask attention matrices with prefix adapters to control the behavior of the model and leverages cross-modal contents like AST and code comment to enhance code representation. To encode AST that is represented as a tree in parallel, we propose a one-to-one mapping method to transform AST in a sequence structure that retains all structural information from the tree. Furthermore, we propose to utilize multi-modal contents to learn representation of code fragment with contrastive learning, and then align representations among programming languages using a cross-modal generation task. We evaluate UniXcoder on five code-related tasks over nine datasets. To further evaluate the performance of code fragment representation, we also construct a dataset for a new task, called zero-shot code-to-code search. Results show that our model achieves state-of-the-art performance on most tasks and analysis reveals that comment and AST can both enhance UniXcoder.

Added

2026-09-28

GraphCodeBERT: Pre-training Code Representations with Data Flow

GraphCodeBERT: Pre-training Code Representations with Data Flow

Daya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng, Duyu Tang, Shujie Liu, Long Zhou, Nan Duan, Jian Yin, Daxin Jiang, Ming Zhou

OrganizationsBeihang UniversityHarbin Institute of TechnologyMicrosoftPeking UniversitySun Yat-sen University

Why you should read this

Introduces GraphCodeBERT, a pre-trained Transformer model that incorporates variable data-flow graphs to capture semantic code structure, achieving state-of-the-art performance across code search, clone detection, and translation without the overhead of deep abstract syntax trees.

Pre-trained models for programming language have achieved dramatic empirical improvements on a variety of code-related tasks such as code search, code completion, code summarization, etc. However, existing pre-trained models regard a code snippet as a sequence of tokens, while ignoring the inherent structure of code, which provides crucial code semantics and would enhance the code understanding process. We present GraphCodeBERT, a pre-trained model for programming language that considers the inherent structure of code. Instead of taking syntactic-level structure of code like abstract syntax tree (AST), we use data flow in the pre-training stage, which is a semantic-level structure of code that encodes the relation of "where-the-value-comes-from" between variables. Such a semantic-level structure is neat and does not bring an unnecessarily deep hierarchy of AST, the property of which makes the model more efficient. We develop GraphCodeBERT based on Transformer. In addition to using the task of masked language modeling, we introduce two structure-aware pre-training tasks. One is to predict code structure edges, and the other is to align representations between source code and code structure. We implement the model in an efficient way with a graph-guided masked attention function to incorporate the code structure. We evaluate our model on four tasks, including code search, clone detection, code translation, and code refinement. Results show that code structure and newly introduced pre-training tasks can improve GraphCodeBERT and achieves state-of-the-art performance on the four downstream tasks. We further show that the model prefers structure-level attentions over token-level attentions in the task of code search.

Added

2026-09-18