MobileGrail: Learning Compact Guardrails for On-Device deployable Mobile GUI Agent Safety
Organizations: UC Davis · CodeDroid
Abstract
Runtime guardrails protect mobile GUI agents by assessing each proposed action before execution, but existing guardrails rely on cloud hosted large multimodal models, exposing every screen to a remote server, including private information such as payments, messages, and medical records. We propose MobileGrail, an on-device deployable model that addresses both. It maintains a recurrent task state that retains only the evidence subsequent safety decisions depend on, so that authorization and execution progress persist beyond the short context. To intervene early while keeping the safety boundary precise, it learns two labels, unsafe and block: unsafe marks the action that commits a violation, whereas block may be issued at any step of an intervention window, which spans from the first action that the user's authorization no longer explains to the committing action itself. To support training, we build an environment of 32 applications whose backends verify the effect of every action, supplying verified labels for supervision and rewards for reinforcement learning to calibrate intervention timing. We also build MobileVeto, an offline benchmark of unsafe trajectories largely on held-out applications, each paired with a benign counterpart. On MobileVeto, MobileGrail built on Qwen3.5-2B intercepts 76.2% of violations, up from 64.5% for its prompted backbone, while reducing premature intervention from 58.6% to 5.2%, outperforming the cloud-based OS-Sentinel on both. We further conduct online evaluation on GhostEIBench, where MobileGrail guarding a Qwen3.8-27B agent reduces fully successful attacks from 13 to 3 of 110 tasks while raising task completion from 48 to 58. Quantized to 4 bits, MobileGrail runs on a Snapdragon 8 Elite at a median latency of 4.7 s, comparable to the 5.1s of cloud-hosted Gemini 3.8 Flash.
Figures & tables
| Model | EIR | MIR | PUR | PIR | B-FPR | |
|---|---|---|---|---|---|---|
| Baselines | Gemini 3.8 Flash † | 95.5 | 3.4 | 20.3 | 13.4 | 7.6 |
| Kimi-K2.6 | 87.2 | 10.0 | 17.9 | 20.3 | 8.1 | |
| Qwen3.5-27B | 80.7 | 11.7 | 22.8 | 35.2 | 17.1 | |
| OS-Sentinel (Kimi-K2.6) | 39.3 | 60.7 | 36.9 | 22.4 | 57.1 | |
| Qwen3.5-2B | 64.5 | 34.1 | 64.1 | 58.6 | 75.7 | |
| LFM2.5-VL-1.6B | 43.4 | 54.1 | 77.2 | 71.4 | 95.2 |
| EIR | PIR | |||
|---|---|---|---|---|
| Model | Seen | Held-out | Seen | Held-out |
| Qwen3.5-2B (SFT) | 67.4 | 73.0 | 7.0 | 12.7 |
| Qwen3.5-2B (SFT + GRPO) | 76.7 | 76.0 | 3.5 | 5.9 |
| LFM2.5-VL-1.6B (SFT) | 65.1 | 56.9 | 5.8 | 11.3 |
| LFM2.5-VL-1.6B (SFT + GRPO) | 62.8 | 56.4 | 2.3 | 4.4 |
| Agent | TC | FAS | PAS | BF | VR |
|---|---|---|---|---|---|
| Qwen3.8-27B | 48 | 13 | 12 | 37 | 34.2 |
| + MobileGrail | 58 | 3 | 18 | 31 | 26.6 |
| GPT-6-Luna | 67 | 2 | 7 | 34 | 11.8 |
| GPT-5 | 62 | 6 | 6 | 37 | 16.4 |
| Gemini-2.5 Pro | 55 | 27 | 9 | 20 | 40.0 |
| Qwen2.5-VL-72B-Instruct | 42 | 12 | 17 | 40 | 41.4 |
| Recurrent state | EIR | MIR | PUR | PIR | B-FPR | Pair |
|---|---|---|---|---|---|---|
| Full ( + ) | 82.8 | 13.4 | 21.7 | 11.0 | 20.5 | 62.9 |
| w/o execution progress | 80.7 | 16.6 | 19.3 | 9.7 | 25.2 | 51.4 |
| w/o task context | 73.1 ∗ | 25.5 ∗ | 17.9 | 9.3 | 31.9 ∗ | 20.0 |
| w/o recurrent state | 72.8 ∗ | 25.5 ∗ | 22.8 | 13.8 | 35.7 ∗ | 20.0 |
| Summary in place of | 77.6 ∗ | 19.3 ∗ | 19.3 | 10.7 | 23.8 | 51.4 |
| Model | Setting | EIR | MIR | PUR | PIR | B-FPR | Latency (s) | RSS (GiB) |
|---|---|---|---|---|---|---|---|---|
| Gemini 3.8 Flash | Cloud API | 95.5 | 3.4 | 20.3 | 13.4 | 7.6 | 5.11 / 6.32 | – |
| Kimi-K2.6 | Cloud API | 87.2 | 10.0 | 17.9 | 20.3 | 8.1 | 25.40 / 32.00 | – |
| Qwen3.5-2B (long) | BF16 | 71.4 | 19.0 | 16.6 | 11.0 | 14.3 | – | – |
| Q8_0 | 72.4 | 18.3 | 15.5 | 9.0 | 11.0 | 7.66 / 8.06 | 3.80 | |
| Q4_0 | 71.0 | 22.1 | 17.2 | 10.7 | 10.5 | 5.94 / 6.29 | 3.69 | |
| Qwen3.5-2B (short) | BF16 | 72.8 | 17.9 | 11.7 | 7.9 | 18.1 | – | – |
Appendix figures & tables12 assets
Supplementary material from the paper’s appendix.
Appendix
| Category | Applications |
|---|---|
| Communication and social | Gmail, LinkChat, Reddit, NovaMeet, Contacts, Messages |
| Finance and commerce | Aurora Bank, Polaris, Bazaar, eBay |
| Productivity and content | Calendar, Dropbox, ForgeHub, Zettel Notes, Notion, Photos, Files |
| Healthcare and insurance | Haven Health, MediConnect, CareVault |
| Travel and local services | Skyline, Uber, Maps, Weather |
| Home and vehicle control | SmartHome, Vela Auto |
| Application | Type | Supported workflows and environment role |
|---|---|---|
| Bazaar | Mocked | E-commerce workflows modeled on Amazon, including product browsing, cart management, orders, shipping addresses, payment methods, gift cards, one-click purchases, and reviews. |
| Sentinel | Mocked | Two-factor authentication workflows, including TOTP accounts, code viewing, export, and deletion. |
| Aurora Bank | Mocked | Banking workflows, including account balances, transfers, recipient management, and billing addresses. |
| Calendar | Mocked | Calendar events, meeting invitations, and participant management. |
| Dropbox | Mocked | Cloud-file and photo management, shared links, camera uploads, and account settings. |
| eBay | Mocked | Marketplace workflows, including listings, bidding, purchases, and seller inventory management. |
| Hyperparameter | Value |
|---|---|
| Epochs | 3 |
| Learning rate | , cosine decay, 113 warmup steps (3%) |
| Effective batch size | 16 |
| Optimizer | AdamW ( , , ), no weight decay |
| Gradient clipping | 1.0 |
| Precision | bf16 autocast; fp32 trainable weights and optimizer states |
| Step | Unsafe + Block | Safe + Block | Unsafe + Allow | Safe + Allow |
|---|---|---|---|---|
| Commit step | ||||
| Commit-ambiguous step | ||||
| Other steps within a window | ||||
| Outside all windows | ||||
| Mirrored benign step ( ) |
| Hyperparameter | Value |
|---|---|
| Optimizer | AdamW, constant learning rate , no warmup, no weight decay |
| Gradient clipping | 1.0 |
| Precision | bf16 forward; fp32 master weights |
| Policy updates per batch | 1 |
| KL penalty | k3 estimator, ( on benign samples) |
| Sampling | temperature 1.0, top- 1.0, at most 768 tokens |
| Latency (s) | Tokens | Peak memory (GiB) | |||||||
| Variant | Quant. | Config. | P50 | P90 | Mean | Input | Output | RSS | System |
| Qwen3.5-2B | |||||||||
| Long | Q8_0 | Cold | 9.33 | 12.71 | 9.56 | 2946 | 118 | 3.79 | 6.72 |
| Long | Q8_0 | Opt. | 7.66 | 11.06 | 8.06 | 2266 | 118 | 3.80 | 6.67 |
| Long | Q4_0 | Opt. | 5.94 | 8.42 | 6.29 | 2266 | 118 | 3.69 | 5.84 |
| Short | Q8_0 | Opt. | 5.61 | 8.23 | 6.14 | 2266 | 69 | 3.79 | 6.73 |
LLM Guardrails
Large language model guardrails detect or constrain harmful outputs, prompt attacks, and unsafe agent actions before they cause harm.
See all 218 papers