Code Completion by Modeling Flattened Abstract Syntax Trees as Graphs
Yanlin Wang, Hui Li

TL;DR
This paper introduces CCAG, a novel code completion method that models flattened AST sequences as graphs, capturing structural and sequential patterns more effectively for improved code prediction accuracy.
Contribution
The paper presents CCAG, a new approach that models ASTs as graphs with attention mechanisms and uses multi-task learning with automatic task balancing, advancing code completion techniques.
Findings
CCAG outperforms state-of-the-art methods in code completion accuracy.
The AST Graph Attention Block effectively captures dependencies in AST graphs.
Multi-task learning with uncertainty improves task optimization without manual tuning.
Abstract
Code completion has become an essential component of integrated development environments. Contemporary code completion methods rely on the abstract syntax tree (AST) to generate syntactically correct code. However, they cannot fully capture the sequential and repetitive patterns of writing code and the structural information of the AST. To alleviate these problems, we propose a new code completion approach named CCAG, which models the flattened sequence of a partial AST as an AST graph. CCAG uses our proposed AST Graph Attention Block to capture different dependencies in the AST graph for representation learning in code completion. The sub-tasks of code completion are optimized via multi-task learning in CCAG, and the task balance is automatically achieved using uncertainty without the need to tune task weights. The experimental results show that CCAG has superior performance than…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
Taxonomy
TopicsSoftware Engineering Research · Software System Performance and Reliability · Software Engineering Techniques and Practices
