Table of Contents
Fetching ...

From UI to Code: Mobile Ads Detection via LLM-Unified Static-Dynamic Analysis

Shang Ma, Wei Cheng, Yanfang Ye, Xusheng Xiao

Abstract

Mobile advertisements (ads) are essential to the app economy, yet detecting them is challenging because ad content is dynamically fetched from remote servers and rendered through diverse user interfaces (UIs), making ads difficult to locate and trigger at runtime. To address this challenge, we present ADWISE, a novel framework that formulates mobile ads detection as LLM-guided, ad-oriented UI exploration. ADWISE first performs static program analysis to identify UI widgets used to place ads, which we call ad widgets. It then uses a grounded LLM reasoning loop to navigate toward and trigger these widgets under three complementary domain guidance signals: (1) WTG-based guidance, which provides global transition priors from a statically constructed window transition graph (WTG); (2) semantic guidance, which reasons over app functionality to prioritize user-likely interaction paths; and (3) structural guidance, which applies retrieval-augmented generation to match the current UI against recurring ad-heavy layouts from a knowledge base. By combining static program analysis with LLM-based reasoning over UI structure, app semantics, and retrieved analogies, ADWISE enables more effective ads detection in complex mobile UIs. Experiments on 100 benchmark apps show that ADWISE outperforms state-of-the-art baselines by 25.60% in ad widget detection. In addition, ADWISE uncovers 34.34% more ad regulation violations across six categories, directly benefiting downstream ad regulation.

From UI to Code: Mobile Ads Detection via LLM-Unified Static-Dynamic Analysis

Abstract

Mobile advertisements (ads) are essential to the app economy, yet detecting them is challenging because ad content is dynamically fetched from remote servers and rendered through diverse user interfaces (UIs), making ads difficult to locate and trigger at runtime. To address this challenge, we present ADWISE, a novel framework that formulates mobile ads detection as LLM-guided, ad-oriented UI exploration. ADWISE first performs static program analysis to identify UI widgets used to place ads, which we call ad widgets. It then uses a grounded LLM reasoning loop to navigate toward and trigger these widgets under three complementary domain guidance signals: (1) WTG-based guidance, which provides global transition priors from a statically constructed window transition graph (WTG); (2) semantic guidance, which reasons over app functionality to prioritize user-likely interaction paths; and (3) structural guidance, which applies retrieval-augmented generation to match the current UI against recurring ad-heavy layouts from a knowledge base. By combining static program analysis with LLM-based reasoning over UI structure, app semantics, and retrieved analogies, ADWISE enables more effective ads detection in complex mobile UIs. Experiments on 100 benchmark apps show that ADWISE outperforms state-of-the-art baselines by 25.60% in ad widget detection. In addition, ADWISE uncovers 34.34% more ad regulation violations across six categories, directly benefiting downstream ad regulation.

Paper Structure

This paper contains 34 sections, 2 equations, 13 figures, 4 tables, 1 algorithm.

Figures (13)

  • Figure 1: Examples of unwanted mobile ads.
  • Figure 2: Code snippets for ad widgets.
  • Figure 3: Overview of AdWise. Given an APK, AdWise first statically identifies ad widgets and constructs a WTG in the offline phase. It then executes the app to navigate to ad-related UIs and trigger the identified ad widgets based on their resource-ids and events. After exhausting ad widgets in the current UI, AdWise computes WTG-based, semantic, and structural guidance to help the LLM choose the next widget for exploration. The process repeats until all ad widgets are triggered or the resource budget is exhausted.
  • Figure 4: Inference rules for ad widgets.
  • Figure 5: Mobile ad pipeline.
  • ...and 8 more figures

Theorems & Definitions (2)

  • Definition 1: UI Layout, Widget
  • Definition 2: Ad Widget