Papers
Topics
Authors
Recent
Search
2000 character limit reached

AppRay: Automated Dark Pattern Detection

Updated 7 March 2026
  • AppRay is an automated system that detects static and dynamic dark patterns in mobile app UIs using a two-stage pipeline combining LLM-guided task exploration with contrastive multimodal classification.
  • It integrates GPT-4 powered task navigation with RL-driven random exploration to collect a diverse set of UI states, ensuring high coverage and complementarity.
  • The system employs a Siamese network-based multi-label classifier with rule-based refiners, achieving significant improvements over previous dark pattern detection methods.

AppRay is an automated system designed to detect static and dynamic dark patterns in mobile apps via a two-stage pipeline integrating LLM-guided exploration with contrastive multimodal classification and rule-based refinement. It addresses the challenge of manually intensive and incomplete dark pattern detection by unifying commonsense task-based UI traversal with systematic screen analysis, yielding the AppRay-Dark and AppRay-Light datasets and substantially outperforming prior approaches in both static and dynamic pattern identification (Chen et al., 2024).

1. System Architecture

AppRay comprises two principal subsystems: the Exploration Engine and the Detection Engine. The Exploration Engine collects a comprehensive set of unique UI states by merging task-based, LLM-powered navigation with reinforcement-learning-driven random exploration. The Detection Engine receives deduplicated UI screens and decomposes them into semantic components, which are then analyzed by a multimodal, contrastive learning-based multi-label classifier and filtered by a rule-based refiner.

Subsystem Components Primary Function
Exploration Engine - Task-Oriented Navigator (GPT-4)<br>- Random Explorer (FastBot2)<br>- UI Merging/Dedup High-coverage, semantically rich UI state collection
Detection Engine - UI Property Extraction/Clustering<br>- Multi-label Classifier<br>- Rule-Based Refiner Automated identification and refinement of dark pattern instances

This pipeline facilitates thorough, contextually meaningful exploration and subsequent detection of both isolated and temporally-linked interface manipulations.

2. Task-Oriented and Random App Exploration

AppRay’s core advancement in exploration is its utilization of GPT-4 for simulated end-user task completion, such as navigating to and disabling notification settings. The system serializes the Android UI hierarchy at each step, structures it as a prompt, and queries GPT-4 for the next action (e.g., tap, scroll, type, back). The prompting scheme uses in-context learning with few-shot task examples and requires the model to produce actions with explicit targets and coordinates.

After executing a set of user tasks (achieving an average 75.1% task completion rate across seven canonical tasks), AppRay initiates FastBot2—an RL-based random explorer—on the same app, ensuring a broader exploration spectrum. Across 100 apps, GPT-4 alone uncovers 2,575 unique screens, FastBot2 8,680, and their union constitutes 8,680 states (with a mere 1.8% overlap), indicating high complementarity and enlarged coverage. Screenshots and hierarchies are deduplicated using pixel-level and tree-structure comparison before analysis.

3. Contrastive Learning–Based Multi-Label Classifier

For each component within a UI and its full-screen context, AppRay employs a Siamese architecture:

  • Image Encoder: ResNet50 (shared weights) processes the cropped component and full-screen images.
  • Text Encoder: BERT-base encodes OCR-extracted text (or a null token for non-textual components).
  • Feature Aggregator: Concatenates the two image embeddings and the text embedding, passing them into a multi-layer perceptron with sigmoid outputs corresponding to each of the 16 dark pattern classes.

The classifier is optimized by a joint objective: multi-label cross-entropy and a contrastive loss encouraging class-consistent embedding proximity. For input pairs (xi,xj)(x_i, x_j) with embeddings fw(xi),fw(xj)f_w(x_i), f_w(x_j), the contrastive loss,

LD=logexp(D(xi,xj)/τ)k=1Nexp(D(xi,xk)/τ)L_D = -\log \frac{\exp( D(x_i, x_j)/\tau )}{\sum_{k=1}^N \exp( D(x_i, x_k)/\tau )}

with D(xi,xj)=fw(xi)fw(xj)2D(x_i, x_j) = \|f_w(x_i) - f_w(x_j)\|_2, temperature τ\tau, and total negatives NN, is weighted and combined with class-weighted cross-entropy:

L=c=1Cwc[LCE+Lcontrastive]\mathcal{L} = \sum_{c=1}^C w_c [ L_{CE} + L_{contrastive} ]

Each class prediction is sigmoid-activated, supporting multi-label output for components exhibiting multiple pattern strategies.

4. Rule-Based Refiner

Output scores from the classifier are refined by heuristics utilizing temporal and semantic UI context. For example:

  • The “Nagging” label is verified only if a pop-up recurs after user backtracking.
  • “Bait-and-Switch” requires detection of relocation or relabeling of a button’s bounding box between sequential screens.
  • “Roach Motel” is flagged if an “unsubscribe” action is buried two or more taps deeper than “subscribe”.
  • Low contrast is used to discount misclassified “Disguised Ad” instances, as genuine ads tend to be visually prominent.

This postprocessing stage filters false positives and enforces stricter assignment criteria, especially for dynamic, temporally linked patterns.

5. Datasets: AppRay-Dark and AppRay-Light

AppRay generated two open datasets, annotated and split strictly by app for 5-fold cross-validation:

  • AppRay-Dark: From 100 apps, yielding 19,722 UIs (8,408 unique post-deduplication). Annotators labeled 2,185 deceptive pattern instances (across 18 types), including 149 dynamic cases involving sequence linkage. Each instance was annotated with bounding boxes; dynamic patterns were linked via a “linker” digit.
  • AppRay-Light: To establish a reliable false-positive baseline, 1,469 UIs with no dark patterns were sampled; 871 were confirmed benign by author consensus.

Annotation was conducted independently by two authors in LabelImg; disagreements were resolved by a third annotator.

6. Empirical Evaluation

On AppRay-Dark, AppRay achieves micro-averaged Precision = 0.77, Recall = 0.76, F1 = 0.76; macro-averaged Precision = 0.65, Recall = 0.62, F1 = 0.62. Baseline comparators AidUI (micro F1 = 0.12) and UIGuard (micro F1 = 0.30) performed markedly worse.

Dynamic patterns, such as “Bait-and-Switch” and “Roach Motel,” exhibited recall rates above 0.80 post-refinement. Ablation studies show additive gains with data augmentation, negative sampling, and class weighting, especially for rare pattern classes; the combined approach achieves micro F1 = 0.893, macro F1 = 0.770.

Coverage statistics highlight that the LLM navigator and FastBot2 explorer are highly complementary, with only 1.8% of states found by both; 35% of activities were found exclusively by GPT-4, 41% only by FastBot2.

7. Limitations and Prospects

Identified limitations include inability to automate tasks requiring external credentials, view hierarchy artifacts (e.g., unlabeled icons), and the fragility of hand-engineered refiners to UI modifications. The authors propose advances such as integrating chain-of-thought prompting, leveraging larger multimodal LLMs, extending detection taxonomies (to voice-driven UIs), automatic rule induction from learned representations, and generalization to web and IoT interfaces using the same two-stage framework.

A plausible implication is that the synergy of structured task completion, deep contrastive multimodal modeling, and lightweight rule refinement provides a viable blueprint for future dark pattern discovery systems in heterogeneous digital interfaces (Chen et al., 2024).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to AppRay System.