# Code Completion with Neural Attention and Pointer Networks

Source: [Code Completion with Neural Attention and Pointer Networks](<https://www.sota2.com/research/paper/68fa66551e209131cea0f8ae>)

Collection index: [llms.txt](<https://www.sota2.com/research/llms.txt>)

Data updated: 2025-10-25T21:47:30.843Z

Authors: Jian Li, Yue Wang, Michael R. Lyu, Irwin King

Published: 2017-11-27T08:17:16.000Z

## Abstract

Intelligent code completion has become an essential research task to accelerate modern software development. To facilitate effective code completion for dynamically-typed programming languages, we apply neural language models by learning from large codebases, and develop a tailored attention mechanism for code completion. However, standard neural language models even with attention mechanism cannot correctly predict the out-of-vocabulary (OoV) words that restrict the code completion performance. In this paper, inspired by the prevalence of locally repeated terms in program source code, and the recently proposed pointer copy mechanism, we propose a pointer mixture network for better predicting OoV words in code completion. Based on the context, the pointer mixture network learns to either generate a within-vocabulary word through an RNN component, or regenerate an OoV word from local context through a pointer component. Experiments on two benchmarked datasets demonstrate the effectiveness of our attention mechanism and pointer mixture network on the code completion task.

## Recorded benchmark results

A research result applies to its stated dataset, split, metric and evaluation configuration. Compare like-for-like settings, preserve the metric's unit and direction, and distinguish paper-reported results from independent reproduction. The best result recorded here is not a claim of exhaustive, current global coverage.

- [Next token prediction on internal](<https://www.sota2.com/research/sota/next-token-prediction-on-internal.md>): Next-token prediction; Internal; MRR: 0.552.

- [Next token prediction on py150](<https://www.sota2.com/research/sota/next-token-prediction-on-py150.md>): Next-token prediction; PY150; MRR: 59.7.

## Original sources and implementation

[Original paper](<https://arxiv.org/abs/1711.09573>)

[PDF](<https://arxiv.org/pdf/1711.09573.pdf>)
