Modelling Natural Language, Programs, and their Intersection

Graham Neubig, Miltiadis Allamanis

Introduction

The global demand for software is rapidly outstripping the pace of traditional IT education, creating a significant bottleneck in technological advancement. To address this, researchers are increasingly looking toward machine learning to bridge the gap between human intent—expressed in natural language (NL)—and executable instructions—written in programming languages (PL). This work explores the "bimodal" nature of source code, treating it not just as a set of instructions for hardware, but as a sophisticated medium for human communication.

The Bimodal Nature of Source Code

A foundational insight of this research is that source code is inherently bimodal. It serves two distinct purposes simultaneously:

  1. Hardware Execution: It provides the formal logic and instructions necessary for a computer to perform tasks.
  2. Human Communication: It contains a massive amount of human-oriented information—such as variable names, method identifiers, and comments—that follows linguistic patterns.

Because humans write, read, and maintain code, the human-oriented modality is incredibly strong. By modeling the relationship between these two modalities, we can develop tools for automatic code generation, documentation, and semantic search, effectively making programming more accessible to non-experts.

Methodological Framework

Rather than proposing a single algorithm, this research outlines a curriculum for modeling the intersections of NL and PL. The proposed methods focus on several key areas:

  • Machine Learning for Translation: Utilizing NLP techniques such as semantic parsing and grounded natural language generation to map between the informal nature of NL and the formal structure of PL.
  • Bimodal Modeling: Analyzing the synergy between formal logic and the informal natural language embedded within the code.
  • Grounded Semantics: Treating source code as a unique form of "procedural grounding." Unlike grounding in robotics or vision, code provides a purely digital environment where language can be mapped to specific, executable actions.
  • Collaborative Analysis: Studying data from multi-party software projects to understand how developer communication relates to the code they produce.

Code as a Research Catalyst

The intersection of NL and PL offers a unique feedback loop for mainstream NLP research. Programming languages provide a deterministic environment for studying grounded communication. For humans who are not well-versed in programming, natural language serves as the primary interface; connecting PL to NL lowers the barrier to entry for software creation. Furthermore, the techniques used to model code can often be applied back to traditional language tasks, creating an interdisciplinary synergy across software engineering and machine learning.

Challenges and Future Directions

Despite the burgeoning interest in this field, significant hurdles remain. The primary challenge lies in the specialized nature of programming and the difficulty of mapping the formal, rigid nature of PL to the often ambiguous and informal nature of NL.

Future work involves refining these mapping methods—both code-to-language and language-to-code—to improve the efficiency of software development. As the field matures, the goal is to create a more seamless interface between human thought and machine execution, ultimately democratizing the ability to create software.

Summary updated

BibTeX
@inproceedings{neubig2018modelling,
  author = {Graham Neubig and Miltiadis Allamanis},
  title = {{Modelling Natural Language, Programs, and their Intersection}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2018},
  doi = {10.18653/v1/n18-6001},
}
Figure