Tell Me What's Next: Textual Foresight for Generic UI Representations

Andrea Burns, Kate Saenko, Bryan A. Plummer

Abstract

Mobile app user interfaces (UIs) are rich with action, text, structure, and image content that can be utilized to learn generic UI representations for tasks like automating user commands, summarizing content, and evaluating the accessibility of user interfaces. Prior work has learned strong visual representations with local or global captioning losses, but fails to retain both granularities. To combat this, we propose Textual Foresight, a novel pretraining objective for learning UI screen representations. Textual Foresight generates global text descriptions of future UI states given a current UI and local action taken. Our approach requires joint reasoning over elements and entire screens, resulting in improved UI features: on generation tasks, UI agents trained with Textual Foresight outperform state-of-the-art by 2% with 28x fewer images. We train with our newly constructed mobile app dataset, OpenApp, which results in the first public dataset for app UI representation learning. OpenApp enables new baselines, and we find Textual Foresight improves average task performance over them by 5.7% while having access to 2x less data.

Introduction

Building AI agents capable of navigating mobile applications—whether to assist visually impaired users or to automate complex workflows—requires a sophisticated understanding of User Interfaces (UIs). Current state-of-the-art models typically rely on "Element Captioning," a method where the model learns to describe individual components like buttons or icons. While effective for local semantics, this approach often misses the "global" context (e.g., recognizing a list of items as a specific shopping cart) and fails to account for the dynamic nature of UIs, where actions lead to state changes.

Furthermore, the field has been hampered by a reliance on massive, proprietary datasets. This lack of transparency makes it difficult for the broader research community to reproduce results or iterate on existing architectures. To address these gaps, we introduce Textual Foresight, a pretraining objective that emphasizes the relationship between actions and visual transitions, and OpenApp, the first large-scale public dataset for UI representation learning.

The Textual Foresight Objective

The core innovation of this work is the Textual Foresight pretraining task. Rather than asking a model to identify a static element, we pose a predictive question: "What will the screen look like if the UI object at these specific coordinates is interacted with?"

To succeed at this task, a model must perform three levels of reasoning:

  1. Local Identification: Recognize the element at the provided [x, y] coordinates (e.g., a "Search" icon).
  2. Global Contextualization: Understand the current state of the application (e.g., a home screen).
  3. Predictive Modeling: Anticipate the resulting global state (e.g., an active keyboard and search bar).

We implement this using the BLIP-2 framework, which utilizes a "Q-Former" to bridge a frozen image encoder (ViT) and a Large Language Model (FlanT5). The model is trained to minimize the cross-entropy loss between its generated description and the ground-truth summary of the subsequent screen.

OpenApp: A Public Benchmark

To support this research, we developed OpenApp, a dataset designed to democratize UI representation learning. OpenApp merges and post-processes existing sources like MoTIF and Android In The Wild (AITW), resulting in approximately 5.7 million images and 2.9 million "foresight" triplets (current screen, action, next screen).

To generate high-quality training targets, we leveraged GPT-3.5 Turbo to produce screen summaries based on the underlying view hierarchy—the structural metadata or "code" of the UI. This provides a rich, text-based ground truth that the vision-based model must learn to predict from raw pixels.

Key Insights and Results

Our experiments reveal that Textual Foresight significantly improves both the quality and efficiency of UI representations:

  • Data Efficiency: By utilizing a more semantically demanding pretraining task, our model outperformed previous leaders like Google’s Spotlight while requiring 28x fewer training images. This suggests that the quality of the objective is as critical as the scale of the data.
  • Superior Generation: On tasks such as screen summarization and element captioning, Textual Foresight achieved an average CIDEr score of 126.7, surpassing the 124.3 achieved by previous state-of-the-art models.
  • Improved Grounding and Tappability: The representations learned via foresight also translate to better performance on predictive tasks. We observed a 10-point F1 score improvement in "tappability" (predicting if an element is interactive) and significant gains in language grounding (locating elements based on natural language commands).
  • Information Density: We found that for certain UI tasks, raw "Element Lists" can be more effective than natural language summaries. This indicates that for specialized domains like mobile UIs, information density and precision are often more valuable than grammatical fluidity.

Limitations and Future Directions

While Textual Foresight represents a significant step forward, several challenges remain. The reliance on LLM-generated summaries can introduce noise or hallucinations if the underlying app metadata is incomplete. Additionally, the current model is limited to English-language interfaces and primarily focuses on "tap" actions. Future work will explore expanding the model's capabilities to include complex gestures like swipes and long-presses, as well as multilingual support to ensure global accessibility.

Summary updated

Abstract

Mobile app user interfaces (UIs) are rich with action, text, structure, and image content that can be utilized to learn generic UI representations for tasks like automating user commands, summarizing content, and evaluating the accessibility of user interfaces. Prior work has learned strong visual representations with local or global captioning losses, but fails to retain both granularities. To combat this, we propose Textual Foresight, a novel pretraining objective for learning UI screen representations. Textual Foresight generates global text descriptions of future UI states given a current UI and local action taken. Our approach requires joint reasoning over elements and entire screens, resulting in improved UI features: on generation tasks, UI agents trained with Textual Foresight outperform state-of-the-art by 2% with 28x fewer images. We train with our newly constructed mobile app dataset, OpenApp, which results in the first public dataset for app UI representation learning. OpenApp enables new baselines, and we find Textual Foresight improves average task performance over them by 5.7% while having access to 2x less data.
BibTeX
@inproceedings{burns2024tell,
  author = {Andrea Burns and Kate Saenko and Bryan A. Plummer},
  title = {{Tell Me What's Next: Textual Foresight for Generic UI Representations}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  url = {https://openreview.net/forum?id=eTDF3cN43R},
}
Figure