Abstract
We present Text2App — a framework that allows users to create functional Android applications from natural language specifications. The conventional method of source code generation tries to generate source code directly, which is impractical for creating complex software. We overcome this limitation by transforming natural language into an abstract intermediate formal language representing an application with a substantially smaller number of tokens. The intermediate formal representation is then compiled into target source codes. This abstraction of programming details allows seq2seq networks to learn complex application structures with less overhead. In order to train sequence models, we introduce a data synthesis method grounded in a human survey. We demonstrate that Text2App generalizes well to unseen combinations of app components and is capable of handling noisy natural language instructions. We explore the possibility of creating applications from highly abstract instructions by coupling our system with GPT-3 — a large pretrained language model. We perform an extensive human evaluation and identify the capabilities and limitations of our system. The source code, a ready-to-run demo notebook, and a demo video are publicly available at https://github.com/text2app/Text2App.
Introduction
Generating software source code directly from natural language (NL) is a long-standing goal in computer science. However, current deep learning models often struggle with the verbosity of raw source code, which leads to long-range dependency issues and low accuracy for complex systems. Text2App addresses this by introducing a modular pipeline that translates human instructions into a compact intermediate formal language, focusing on high-level logic and structure rather than line-by-line coding.
The Text2App Architecture
The Text2App framework follows a multi-stage process to convert text into a ready-to-use Android package (.apk). As shown in the pipeline diagram below, the system first tokenizes and pre-processes the natural language description. This processed text is then fed into a sequence-to-sequence (seq2seq) neural network that outputs a formal representation.
Simplified App Representation (SAR)
The core innovation of this work is the Simplified App Representation (SAR). SAR is a minimal formal language designed to describe an app's components (e.g., buttons, textboxes) and logic (e.g., "when button clicked, speak text") using a very small number of tokens. This abstraction significantly reduces the computational overhead on the neural network compared to generating Java or Kotlin code directly.
Once the seq2seq model generates the SAR string, a custom-built SAR compiler converts it into the file formats used by the MIT App Inventor (.scm for layout and .bky for logic). These files are then sent to the MIT App Inventor backend, which compiles them into a final, installable .apk file.
Data Synthesis and Training
Because no large-scale "NL-to-Android" dataset existed, the authors created a synthetic dataset of 50,000 unique NL-SAR pairs. This synthesis was grounded in a human survey to ensure the generated descriptions mirrored how people naturally describe mobile applications. To enhance robustness and prevent the model from becoming too rigid, the researchers used BERT-based augmentation to mask and replace words in the synthetic descriptions, introducing natural linguistic variety. This step improved the model's performance on real-world data by up to 22%.
Evaluation and Results
The system was evaluated using three architectures: a Pointer Network and two Transformers (initialized with RoBERTa and CodeBERT). The RoBERTa-based Transformer achieved the highest performance, with a BLEU score of 97.66 and an Exact Match (EM) rate of 81.76% on synthetic data.
Crucially, the model demonstrated strong generalization capabilities. It successfully generated apps for "Unseen Pairs"—combinations of components it never encountered during training—with over 84% Exact Match accuracy. In real-world testing with 112 human-provided descriptions, the system achieved a BLEU-1 score of 54.99. Manual inspection showed that many "failures" were actually functionally correct apps that simply used different naming conventions than the ground truth.
Conclusion and Future Work
Text2App currently supports a library of 12 components and over 10 actions, covering essential Android functionality. While the model can be biased toward keywords used in the synthesizer, the integration of GPT-3 as a pre-processor shows promise for handling highly abstract user requests (e.g., "make a browser app"). Future work aims to expand the component library and explore generating native code while maintaining the efficiency of the intermediate SAR abstraction.
Summary updated