Reproduce “Code Completion by Modeling Flattened Abstract Syntax Trees as Graphs” on OpenResearch

Run Claude Code, Codex or any coding agent as a research agent: literature, hypotheses and experiments on your laptop, cluster or cloud GPUs.

Universal app for Apple silicon and Intel. Requires macOS 11 or later.

About this paper

Yanlin Wang, Hui Li

A new system called CCAG improves code completion by modeling flattened Abstract Syntax Trees as graphs, which captures sequential, repetitive, and structural code patterns. This approach, combined with a specialized graph attention network and uncertainty-based multi-task learning, demonstrates superior accuracy on JavaScript and Python datasets compared to existing methods.

Key insights

  • Synthesizing flattened sequential Abstract Syntax Trees with graph representations effectively captures sequential, repetitive, and structural patterns of code, offering a more comprehensive understanding than either approach alone.
  • Explicitly modeling different types of relationships within the code graph (local sequential adjacency, global dependencies, parent-child hierarchy) through specialized attention layers enhances feature learning for code completion.
  • Automatically balancing multi-task learning losses based on task uncertainty during training improves overall model performance and simplifies the optimization process for predicting both value and type.

Summary by alphaXiv.

Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.