# SWIM: Synthesizing What I Mean

arXiv: https://arxiv.org/abs/1511.08497 · HTML: https://mlsanity.com/paper/1511.08497/

## Key facts

- Cited by 10 papers in the map (data through 14 Oct 2026).
- First posted on arXiv 26 Nov 2015.

## Built on by (most cited first, 10 of 10)

- [Compositional API Recommendation for Library-Oriented Code Generation](https://mlsanity.com/paper/2402.19431/) (2024)
- [On the Effectiveness of Pretrained Models for API Learning](https://mlsanity.com/paper/2204.03498/) (2022)
- [Natural Language-Guided Programming](https://mlsanity.com/paper/2108.05198/) (2021)
- [A Systematic Review of Automated Query Reformulations in Source Code Search](https://mlsanity.com/paper/2108.09646/) (2021)
- [Plot2API: Recommending Graphic API from Plot via Semantic Parsing Guided Neural Network](https://mlsanity.com/paper/2104.01032/) (2021)
- [Procedures as Programs: Hierarchical Control of Situated Agents through Natural Language](https://mlsanity.com/paper/2109.08214/) (2021)
- [Code Sophistication: From Code Recommendation to Logic Recommendation](https://mlsanity.com/paper/2201.07674/) (2022)
- [Code Compliance Assessment as a Learning Problem](https://mlsanity.com/paper/2209.04602/) (2022)
- [Contrastive Prompt Learning-based Code Search based on Interaction Matrix](https://mlsanity.com/paper/2310.06342/) (2023)
- [XSearch: Explainable Code Search via Concept-to-Code Alignment](https://mlsanity.com/paper/2605.16046/) (2026)

## Abstract (arXiv)

Modern programming frameworks come with large libraries, with diverse applications such as for matching regular expressions, parsing XML files and sending email. Programmers often use search engines such as Google and Bing to learn about existing APIs. In this paper, we describe SWIM, a tool which suggests code snippets given API-related natural language queries such as "generate md5 hash code". We translate user queries into the APIs of interest using clickthrough data from the Bing search engine. Then, based on patterns learned from open-source code repositories, we synthesize idiomatic code describing the use of these APIs. We introduce structured call sequences to capture API-usage patterns. Structured call sequences are a generalized form of method call sequences, with if-branches and while-loops to represent conditional and repeated API usage patterns, and are simple to extract and amenable to synthesis. We evaluated SWIM with 30 common C# API-related queries received by Bing. For 70% of the queries, the first suggested snippet was a relevant solution, and a relevant solution was present in the top 10 results for all benchmarked queries. The online portion of the workflow is also very responsive, at an average of 1.5 seconds per snippet.
