NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Deep API Programmer: Learning to Program with APIs

Surya Bhupatiraju, Rishabh Singh, Abdel-rahman Mohamed, Pushmeet KohliarXiv 2017

Introduction

Data wrangling—the process of reformatting raw strings into usable data—is a notorious bottleneck in data science, often consuming up to 80% of a practitioner's time. While "Programming-By-Example" (PBE) tools like Microsoft Excel’s FlashFill have made strides in automating these tasks, they face two significant hurdles: limited expressiveness and a reliance on manual engineering. Traditional systems typically depend on low-level syntactic rules (like regular expressions) and require experts to design complex search heuristics for every new domain.

To overcome these limitations, the authors introduce DAPIP (Deep API Programmer), a neural program synthesis system. DAPIP automates data wrangling by learning to compose high-level APIs from just a few input-output examples, replacing manually tuned heuristics with a learned neural search process.

The DAPIP Architecture

DAPIP treats program synthesis as a search problem over a Domain-Specific Language (DSL) containing over 135 APIs. These APIs range from standard regex for substring extraction to sophisticated lookup and transformation functions (e.g., GetStateFromCity).

The DAPIP system architecture: from IO examples to an inferred program tree via the R3NN.

The system architecture consists of three primary modules:

  1. A Rich DSL: A library of functional building blocks that allow the system to perform human-like reasoning.
  2. Cross-Correlational Encoder: This module uses bi-directional LSTMs to analyze input and output strings, identifying which segments were transformed or copied to produce a vector representation of the user's intent.
  3. Recursive-Reverse-Recursive Neural Network (R3NN): The core generator that takes the encoded intent and incrementally constructs a program tree. It predicts the most likely API call or constant string at each node, effectively acting as a learned search heuristic.

Semantic vs. Syntactic Synthesis

A key differentiator for DAPIP is its ability to handle semantic transformations. While previous state-of-the-art systems struggled with meaning-based tasks, DAPIP excels at identifying when to use external data mappings.

Example of a semantic transformation task where city and zip code are mapped to a state name.

By treating high-level APIs as primary constructs, the model can recognize patterns like a city name and correctly infer that a city-to-state API is required. Interestingly, the authors found that these semantic lookups are often easier for the model to learn than complex, nested regex operations, as the "intent" behind a lookup is more distinct in the model's vector space.

Results and Performance

The system was evaluated using both synthetic benchmarks and a set of 238 real-world string transformation tasks from Excel users.

  • FlashFill Benchmarks: DAPIP solved 45% of real-world tasks, significantly outperforming previous neural baselines like Neural FlashFill (which achieved ~23-34%).
  • Semantic Accuracy: On synthetic tests restricted to Lookup and Transformation APIs, the model achieved nearly 98% accuracy.
  • Generalization: The model demonstrated a robust ability to synthesize entirely new programs by composing known APIs in novel ways, proving that it learns the underlying logic of the DSL rather than just memorizing patterns.

Limitations and Future Work

Despite its success, DAPIP faces challenges with program depth; the current model is limited to a maximum program length of 10. As the API library scales into the thousands, the search space may also become increasingly difficult to navigate.

Future research directions include implementing "divide and conquer" strategies—breaking complex output strings into smaller chunks to be solved by sub-programs—and using continuous function embeddings to help the model understand the relationships between similar APIs.

Summary updated

BibTeX
@misc{bhupatiraju2017deep,
  author = {Surya Bhupatiraju and Rishabh Singh and Abdel-rahman Mohamed and Pushmeet Kohli},
  title = {{Deep API Programmer: Learning to Program with APIs}},
  year = {2017},
  eprint = {1704.04327},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1704.04327},
}
Figure