skip to main content
10.1145/3457913.3457933acmotherconferencesArticle/Chapter ViewAbstractPublication PagesinternetwareConference Proceedingsconference-collections
research-article

Adaptive Code Completion with Meta-learning

Authors Info & Claims
Published:21 July 2021Publication History

ABSTRACT

Since human-written programs have useful local regularities, the ability to adapt to unseen, local context is an important challenge that successful models of source code must overcome. However, the current source code models mostly learn a common code pattern from large scale open-source codebases, which cannot make use of the localness nor satisfy developers’ personal preferences. Consequently, fast learning and adapting to unseen code patterns from limited developers’ code can provide new insights into source code completion. In this work, we train a base code model that is best able to learn semantic and structural information from context to improve predictions of unseen local tokens and propose an adaptive code model leveraging meta-learning techniques. We demonstrate highly improved performance in experiments on a large scale Java GitHub corpus compared with baselines.

References

  1. Miltiadis Allamanis, Earl T Barr, Christian Bird, and Charles Sutton. 2015. Suggesting accurate method and class names. In Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering. 38–49.Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Miltiadis Allamanis, Marc Brockschmidt, and Mahmoud Khademi. 2017. Learning to represent programs with graphs. arXiv preprint arXiv:1711.00740(2017).Google ScholarGoogle Scholar
  3. Miltiadis Allamanis and Charles Sutton. 2013. Mining source code repositories at massive scale using language modeling. In 2013 10th Working Conference on Mining Software Repositories (MSR). IEEE, 207–216.Google ScholarGoogle ScholarCross RefCross Ref
  4. Pavol Bielik, Veselin Raychev, and Martin Vechev. 2016. PHOG: probabilistic model for code. In International Conference on Machine Learning. 2933–2942.Google ScholarGoogle Scholar
  5. Marcel Bruch, Martin Monperrus, and Mira Mezini. 2009. Learning from examples to improve code completion systems. In Proceedings of the 7th joint meeting of the European software engineering conference and the ACM SIGSOFT symposium on the foundations of software engineering. 213–222.Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Milan Cvitkovic, Badal Singh, and Anima Anandkumar. 2019. Open Vocabulary Learning on Source Code with a Graph-Structured Cache. ArXiv abs/1810.08305(2019).Google ScholarGoogle Scholar
  7. Hoa Khanh Dam, Truyen Tran, and Trang Thi Minh Pham. 2016. A deep language model for software code. In FSE 2016: Proceedings of the Foundations Software Engineering International Symposium. [The Conference], 1–4.Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Chelsea Finn, Pieter Abbeel, and Sergey Levine. 2017. Model-agnostic meta-learning for fast adaptation of deep networks. In Proceedings of the 34th International Conference on Machine Learning-Volume 70. JMLR. org, 1126–1135.Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Mark Gabel and Zhendong Su. 2010. A study of the uniqueness of source code. Proceedings of the ACM SIGSOFT Symposium on the Foundations of Software Engineering (01 2010), 147–156. https://doi.org/10.1145/1882291.1882315Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Philip Gage. 1994. A new algorithm for data compression. C Users Journal 12, 2 (1994), 23–38.Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Vincent J. Hellendoorn and Premkumar Devanbu. 2017. Are Deep Neural Networks the Best Choice for Modeling Source Code?. In Proceedings of the 2017 11th Joint Meeting on Foundations of Software Engineering (Paderborn, Germany) (ESEC/FSE 2017). Association for Computing Machinery, New York, NY, USA, 763–773. https://doi.org/10.1145/3106237.3106290Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Abram Hindle, Earl T Barr, Zhendong Su, Mark Gabel, and Premkumar Devanbu. 2012. On the naturalness of software. In 2012 34th International Conference on Software Engineering (ICSE). IEEE, 837–847.Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Daqing Hou and David M Pletcher. 2011. An evaluation of the strategies of sorting, filtering, and grouping API methods for code completion. In 2011 27th IEEE International Conference on Software Maintenance (ICSM). IEEE, 233–242.Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Yasir Hussain, Zhiqiu Huang, Yu Zhou, and Senzhang Wang. 2020. CodeGRU: Context-aware deep learning with gated recurrent unit for source code modeling. Information and Software Technology 125 (2020), 106309.Google ScholarGoogle ScholarCross RefCross Ref
  15. Xianhao Jin and Francisco Servant. 2018. The hidden cost of code completion: Understanding the impact of the recommendation-list length on its efficiency. In Proceedings of the 15th International Conference on Mining Software Repositories. 70–73.Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Rafael-Michael Karampatsis and Charles Sutton. 2019. Maybe deep neural networks are the best choice for modeling source code. arXiv preprint arXiv:1903.05734(2019).Google ScholarGoogle Scholar
  17. Hoa Khanh Dam, Truyen Tran, and Trang Pham. 2016. A deep language model for software code. arXiv (2016), arXiv–1608.Google ScholarGoogle Scholar
  18. Diederik P Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980(2014).Google ScholarGoogle Scholar
  19. Jian Li, Yue Wang, Michael R. Lyu, and Irwin King. 2018. Code Completion with Neural Attention and Pointer Networks. In Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence, IJCAI 2018, July 13-19, 2018, Stockholm, Sweden, Jérôme Lang (Ed.). ijcai.org, 4159–4165. https://doi.org/10.24963/ijcai.2018/578Google ScholarGoogle ScholarCross RefCross Ref
  20. Xi Victoria Lin, Chenglong Wang, Deric Pang, Kevin Vu, and Michael D Ernst. 2017. Program synthesis from natural language using recurrent neural networks. University of Washington Department of Computer Science and Engineering, Seattle, WA, USA, Tech. Rep. UW-CSE-17-03-01 (2017).Google ScholarGoogle Scholar
  21. Chang Liu, Xin Wang, Richard Shin, Joseph E Gonzalez, and Dawn Song. 2016. Neural code completion. (2016).Google ScholarGoogle Scholar
  22. Chris Maddison and Daniel Tarlow. 2014. Structured generative models of natural source code. In International Conference on Machine Learning. 649–657.Google ScholarGoogle Scholar
  23. A. T. Nguyen and T. N. Nguyen. 2015. Graph-Based Statistical Language Model for Code. 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering (2015).Google ScholarGoogle Scholar
  24. Tung Thanh Nguyen, Anh Tuan Nguyen, Hoan Anh Nguyen, and Tien N Nguyen. 2013. A statistical semantic language model for source code. In Proceedings of the 2013 9th Joint Meeting on Foundations of Software Engineering. 532–542.Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Romain Robbes and Michele Lanza. 2008. How program history can improve code completion. In 2008 23rd IEEE/ACM International Conference on Automated Software Engineering. IEEE, 317–326.Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Juliana Saraiva, Christian Bird, and Thomas Zimmermann. 2015. Products, developers, and milestones: how should I build my N-Gram language model. In Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering. 998–1001.Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Disha Shrivastava, Hugo Larochelle, and Daniel Tarlow. 2020. On-the-Fly Adaptation of Source Code Models using Meta-Learning. arXiv preprint arXiv:2003.11768(2020).Google ScholarGoogle Scholar
  28. Zhaopeng Tu, Zhendong Su, and Premkumar Devanbu. 2014. On the localness of software. In Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering. 269–280.Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Martin White, Christopher Vendome, Mario Linares-Vásquez, and Denys Poshyvanyk. 2015. Toward deep learning software repositories. In 2015 IEEE/ACM 12th Working Conference on Mining Software Repositories. IEEE, 334–345.Google ScholarGoogle ScholarCross RefCross Ref
  30. Pengcheng Yin and Graham Neubig. 2017. A Syntactic Neural Model for General-Purpose Code Generation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). 440–450.Google ScholarGoogle ScholarCross RefCross Ref
  31. Hao Zhong and Xiaoyin Wang. 2017. Boosting complete-code tool for partial program. In 2017 32nd IEEE/ACM International Conference on Automated Software Engineering (ASE). IEEE, 671–681.Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. Adaptive Code Completion with Meta-learning
          Index terms have been assigned to the content through auto-classification.

          Recommendations

          Comments

          Login options

          Check if you have access through your login credentials or your institution to get full access on this article.

          Sign in
          • Published in

            cover image ACM Other conferences
            Internetware '20: Proceedings of the 12th Asia-Pacific Symposium on Internetware
            November 2020
            264 pages
            ISBN:9781450388191
            DOI:10.1145/3457913

            Copyright © 2020 ACM

            Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 21 July 2021

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • research-article
            • Research
            • Refereed limited

            Acceptance Rates

            Overall Acceptance Rate55of111submissions,50%
          • Article Metrics

            • Downloads (Last 12 months)24
            • Downloads (Last 6 weeks)8

            Other Metrics

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader

          HTML Format

          View this article in HTML Format .

          View HTML Format