---
title: "FireAnt: Efficient on-device agentic phone control"
authors: ["Amir Jalalirad", "Tribhuvanesh Orekondy", "Aleix Torres-Camps", "Alex Batlle Casellas", "Aleksandr Ermolov", "Arnau Padres Masdemont", "Motasem Alfarra", "Dharmesh Tailor", "Corrado Rainone", "Davide Belli", "Suparna S Nair", "Christos Louizos", "Jordi Ros-Giralt", "Ork de Rooij", "Arash Behboodi", "Bence Major"]
date: "2026-12-03"
version: "v1"
address: "https://iraven.io/papers/fireant-efficient-on-device-agentic-phone-2612-06285"
source: "https://arxiv.org/abs/2612.06285"
venue: "arXiv"
licence: "Creative Commons Attribution 4.0 International"
licence_url: "https://creativecommons.org/licenses/by/4.0/"
---

## Abstract

Most work on autonomous phone control treats efficiency as a question of agent design alone: shrink or speed up the policy while leaving the environment it acts in – almost always a real, GUI-first application, driven through screenshots and a vision-language backbone – untouched. This default is not incidental: public benchmarks that control include the controlling of real apps don’t offer workarounds when those apps only expose GUI as interfacing option. As a result, the strongest available agents for that interface are large vision-language models (LVMs). Attempts at increasing system efficiency start from LVMs as starting point, rather than as a property of the system as a whole. We argue efficiency is instead an end-to-end property of the environment and the agent *together*, and should be designed for jointly from the outset. We instantiate this view with an *API-first* framework for agentic phone control, called FireAnt: target applications are mocked as lightweight FastAPI servers rather than full GUI stacks, giving a cheap, scalable substrate for data generation and training; the agent plans and acts exclusively over these structured APIs, never over pixels; and a Portable Action Layer reconciles the interface differences between this mocked training-time environment and the real, on-device target environment, so the same policy deploys to either without retraining. Our harness is also flexible and enables different common agentic functionalities (like context management or safety). Training with the mock environments and the Portable Action Layer, the resulting policy Pareto-dominates the GUI-grounded and frontier general-purpose baselines in success rate versus efficiency on both MobileWorld and MobileGym++, and we show it enables efficient control of real phone applications under the memory and latency constraints of on-device deployment. Project page: [https://qualcomm-ai-research.github.io/device-api-agent/](https://qualcomm-ai-research.github.io/device-api-agent/).

![Uncaptioned image](figures/f1-qc-air.png)

## \\titlefont**1 \\titlefontIntroduction**

![Figure](figures/f2-overview.png)

Figure 1: **End-to-end system overview of FireAnt.** *World Modeling* specifies each target application as a mock REST server (Section 4). *Data Generation* uses these servers to produce tasks, environment states, tests, and expert trajectories, which drive *Training* (Section 6). The trained *Agent design* (Section 5) couples a prompt and tool-discovery scheme with a Portable Action Layer; a set of optional, runtime-toggleable extensions sits alongside it but are not required for the agent to function. Through the Portable Action Layer, the same agent acts interchangeably against the mocked training-time environment or the real, on-device target environment, which is what lets *Evaluation* score both simulated and on-device rollouts with the same LLM-as-judge protocol.

Autonomous control of mobile phones – navigating device features, booking a ride, filing an expense, triaging a mailbox – is one of the most commercially relevant targets for agentic LLMs, and the dominant approach today treats the phone as a pixel grid: an agent screenshots the screen, grounds a handful of candidate elements, and emits a tap or swipe at a set of coordinates \[Zhou et al., 2025; Wang et al., 2025; Venus Team et al., 2026b\]. Since these approaches rely on the user interface, the appeal of GUI-grounded agents is that they work on any user-facing application. However, routing agent actions through pixels instead of through the applications’ underlying APIs means re-deriving, screenshot by screenshot, structure that was already there, at the cost of context length, latency, and robustness to UI redesigns.

Because nearly every benchmark involving control of real applications relies at least partially on GUI interaction, and because the strongest available agents for GUI control are large vision-language models, the field has settled into treating efficiency as a problem of the agent alone: the environment is taken as given, and the only lever left to pull is making the policy smaller or faster.

We argue this framing is incomplete. Efficiency is an end-to-end property of the environment and the agent *together*, and substantial gains are available by co-designing both rather than optimizing an agent in isolation against a GUI-first environment that was never designed with efficiency in mind. We instantiate this view as *API-first* agentic phone control in our system called FireAnt (Frugal Inference with Resource-Efficient Agent, data geNeration and Training). First, we mock the target applications themselves as lightweight FastAPI servers rather than full GUI stacks (Section 4), which turns data generation and training into something cheap, parallel, and fully offline, rather than a process bottlenecked by slow, difficult-to-annotate sessions. Second, the agent plans and acts solely through the structured APIs exposed by these servers (and, at deployment time, by the real OS and apps), never through pixels. Third, a Portable Action Layer (Section 5) reconciles the interface differences between this mocked training-time environment and the real, on-device target environment, so the same policy transfers between the two without retraining or app-specific integration work. Moreover, our agent’s harness is modular and easy to extend with common agentic functionalities, such as hybrid device–cloud execution, safety screening, and context management (Section 5.3). Figure 1 summarizes how these pieces fit together end to end.

Within this framework, the central technical challenges are: (i) constructing mock environments rich enough, and faithful enough, to generate large volumes of solvable, difficulty-controlled tasks with verifiable success criteria; (ii) designing an agent and prompting scheme that plans and acts purely over structured tool calls under on-device constraints, such as limited maximum context length; (iii) changing the implementations of the tool calls from relying on the mock environments to actual calls on-device, leveraging our Portable Action Layer.

We present an end-to-end framework, together with the data and training infrastructure, that addresses these challenges. Section 3 formalizes the problem as a partially observed decision process over a dynamically discovered action space and introduces the notation used throughout the paper. Section 4 describes our data generation pipeline, built around modeling each target application as a fully specified mock server from which we generate tasks, environment states, tests, and expert trajectories at scale. Section 5 describes the agent design: the prompt and tool-discovery scheme, and the Portable Action Layer that makes the training-time and target environments interchangeable. We also include a set of optional, runtime-toggleable extensions that provide important agentic functionalities in the form of different escalation schemes. Section 6 describes our training procedure, and Section 7 discusses the latency and memory constraints of running the resulting model on-device, along with our quantization and export pipeline, and the implementation differences of the Portable Action Layer between training and deployment. Section 8 presents three benchmarks of increasing scale and difficulty – MobileWorld, MobileGym, and MobileGym++ – compares against representative GUI-based agents, and reports results, analysis, and ablations. There, we show that this co-design yields a policy that Pareto-dominates representative GUI-first baselines in success rate versus efficiency. We also introduce AppVerse, our custom dataset, which we use for training and held-out evaluation and which underlies a live, on-device demonstration. On this benchmark, we also share various ablations and analyses. We close with a conclusion summarizing our contributions and open problems in Section 9.

## \\titlefont**2 \\titlefontRelated Work**

We situate our approach within work on GUI- and API-grounded agents, synthetic environments, agent post-training, and on-device inference. Across these areas, we focus on how the action interface and training distribution affect task reliability and the cost of deploying a compact mobile policy.

### 2\.1 GUI-grounded mobile agents

The dominant line of work on phone-controlling agents operates over screenshots: the agent perceives the screen (optionally aided by an accessibility tree), grounds a target element, and outputs a low-level touch or type action. Recent systems in this family include MAI-UI \[Zhou et al., 2025\], UI-TARS \[Qin et al., 2025; Wang et al., 2025\], UI-Venus \[Venus Team et al., 2026b; Venus Team et al., 2026a\], and GUI-Owl \[Xu et al., 2026\], among others \[Yan et al., 2026; Tong et al., 2026\]. Many of them combine vision-language backbones with multi-turn reinforcement learning to improve grounding accuracy and task success across real-world app benchmarks. These systems are attractive because they require no app-specific API integration and can operate across diverse UIs, but they pay for this generality with with image-heavy per-step inputs, sensitivity to visual redesigns, and comparatively high inference cost (more generated tokens and turns). A single app operation may also require several navigation and grounding steps, increasing both interaction cost and opportunities for error. These disadvantages are magnified on-device, where memory, latency, and power budgets are limited. We use representative models from these families as baselines in Section 8 and and compare costs through generated tokens, peak context length, and interaction turns alongside task success.

### 2\.2 Tool-use and API-grounded agents

A separate line of work grounds agents in structured tools and APIs instead of pixels. ReAct \[Yao et al., 2023\] established the now-standard pattern of interleaving reasoning, tool calls, and observations, and subsequent agent frameworks have extended this to larger and more dynamic tool catalogs. When APIs exist, API-based agents outperform GUI agents on WebArena \[Song et al., 2025\] and MobileWorld \[Kong et al., 2026\] where MCP-augmented tasks are added to Android benchmarking. Two obstacles remain for on-device use. First, a full tool catalog overflows a small context. TinyAgent \[Erdogan et al., 2024\] and RAG-MCP \[Gan and Sun, 2025\] retrieve a subset of tools with an additional retriever, and MCP-Zero \[Fei et al., 2025\] lets the model request tools on demand through a separate semantic router whereas in \[Patel et al., 2026\] the required tools are retrieved dynamically. Our tool discovery is also model-driven but needs no retrieval model on the device: the agent lists tool names and descriptions and is trained with discovery in the loop. Second, on-device function-calling models are typically trained for a fixed tool set, while the MCP protocol \[Model Context Protocol, \] and platform interfaces such as Android AppFunctions \[Android Developers, \] standardize how tools are exposed but provide no policy for using them. Our Portable Action Layer (Section 5.2) trains a small policy against mocked app servers and deploys it unchanged on real apps.

### 2\.3 Post-training for agentic LLMs

Modern language models support multi-step tool use \[Yang et al., 2025\], while vision-language agents extend this capability to GUI interaction \[Wang et al., 2025\]. Specializing these capabilities requires both suitable interaction data and objectives that address errors over long trajectories. AppWorld \[Trivedi et al., 2024\] and ToolSandbox \[Lu et al., 2025\] provide controllable, stateful environments for evaluating multi-step tool use, while UI-TARS-2 \[Wang et al., 2025\] develops training infrastructure for collecting agent rollouts and applying multi-turn reinforcement learning. Common post-training approaches include supervised fine-tuning (SFT), direct preference optimization (DPO) \[Rafailov et al., 2023\], on-policy distillation (OPD) \[Agarwal et al., 2024\], and group relative policy optimization (GRPO) \[Shao et al., 2024\]. SFT teaches action formatting and task behavior from expert demonstrations, but trains on expert prefixes rather than the histories induced by the deployed policy. DPO learns from preferred and dispreferred responses without fitting an explicit reward model; its coverage of agent errors depends on the preference data. OPD instead queries a teacher on student-generated sequences, providing dense supervision on prefixes the student actually encounters. GRPO optimizes rewards using relative advantages within groups of sampled rollouts, making it suitable for tasks with verifiable outcomes, although learning depends on reward quality and rollout diversity. Both OPD and on-policy reinforcement learning can reduce the mismatch between training and deployment distributions, but neither guarantees recovery from all agent errors. We primarily investigate SFT and OPD for compact API-grounded mobile policies (Section 6), comparing imitation of successful expert trajectories with teacher supervision on student-generated interactions.

### 2\.4 Synthetic environments and world models for agent training

Collecting data from real devices and services is slow, hard to reset and hard to verify, so agent work relies heavily on simulated environments. Interactive benchmarks host fully functional websites (WebArena \[Zhou et al., 2024\]) or drive Android through the touchscreen (AndroidEnv \[Toyama et al., 2021\], AndroidWorld \[Rawles et al., 2025\]). Recent work scales environments for training instead, through automatically constructed, fully simulated function-calling environments \[Fang et al., 2026\], verifiable multi-turn data generated with simulated users \[Prabhakar et al., 2025\], and GUI trajectories synthesized by exploring first and deriving tasks afterwards \[Sun et al., 2025\]. In our case, each app is a REST server generated from a functionality specification and a data schema, so its state is fully observable, resettable, and programmatically checkable. Tasks are generated before the environment state, which makes difficulty an explicit parameter, and the servers expose the same action contract as the on-device implementation of the Portable Action Layer (Section 5.2), so a policy trained on them can run on real devices.

### 2\.5 On-device LLM deployment

Small language models have been proposed for the repetitive, specialized calls made by agentic systems \[Belcak et al., 2025\]. Although models with a few billion parameters can already run on phones, on-device inference remains constrained by memory, latency, and power \[Xiao et al., 2026\]. Prior systems work addresses prefill and decode separately. Prefill can dominate latency for long agent prompts; Xu et al. \[2025\] offload it to the NPU in fixed-size chunks. Autoregressive decode is often limited by memory bandwidth; proposed optimizations include dynamic activation sparsity \[Federici et al., 2025\] and neuron-level scheduling across the NPU and CPU \[Xue et al., 2024\]. We quantize Qwen3 \[Yang et al., 2025\] to 8-bit weights and 16-bit activations using AIMET \[3\] and use the Genie SDK \[28\] to export static prefill and decode graphs for the Hexagon NPU. Across successive calls within an episode, we reuse the KV cache for the unchanged token prefix, avoiding recomputation for those tokens (Section 7).

## \\titlefont**3 \\titlefontFramework**

This section formalizes the phone control problem and introduces the notation used throughout the paper. We cast an episode as a partially observable Markov decision process $({\mathcal{S}},{\mathcal{O}},{\mathcal{A}},{\mathcal{T}})$: ${\mathcal{S}}$ is the space of underlying device and app states; ${\mathcal{O}}$ is the space of structured observations the agent actually receives – a compact summary of the foreground app’s relevant API-exposed fields (e.g. an open form’s current values, a list view’s visible entries), deliberately excluding raw pixels; ${\mathcal{A}}$ is the action space, the set of tool calls $a=(\text{tool},\text{args})$ exposed across every app in our corpus; and ${\mathcal{T}}:{\mathcal{S}}\times{\mathcal{A}}\to{\mathcal{S}}$ is the transition function. Dispatching an action through the Portable Action Layer (Section 5.2) applies ${\mathcal{T}}$, changing the underlying device/app state and yielding the next observation.

Each episode is additionally conditioned on a natural-language instruction ${\mathcal{I}}$ – the task goal, held fixed for the duration of the episode (Section 4). At step $t$, the agent selects $a_{t}=\pi_{\theta}({\mathcal{I}},o_{t},h_{t})$, where $o_{t}\in{\mathcal{O}}$ is the current observation and $h_{t}=(a_{1},o_{1},\dots,a_{t-1},o_{t-1})$ is a context summary of the episode so far (Section 5.3.3); a full episode is the trajectory $\tau=(o_{1},a_{1},\dots,a_{T-1},o_{T})$ generated by rolling out $\pi_{\theta}$ against ${\mathcal{T}}$.

## \\titlefont**4 \\titlefontData Generation**

Training and evaluating long-horizon phone agent require large volumes of tasks spanning a controlled range of difficulty. Collecting this directly from physical devices does not scale: real sessions are slow and expensive to gather and annotate, and difficulty ends up being whatever the collected tasks happen to contain rather than something we can set deliberately. We instead generate this data from scratch, around a simple idea: make each of the target applications accessible to the agent not through a GUI to be screen-scraped, but as a fully specified REST server that an agent – and our own generation pipeline – can interact with directly. We call this *Agentic World Modeling* (Section 4.1), and it is the shared substrate for every later stage: *Task Generation* (Section 4.2) proposes a natural-language goal before the world state exists, so that the latter can be generated according to explicit difficulty criteria; *Environment State Generation* (Section 4.3) then populates the mock servers with data consistent with that goal; and *Expert Trajectory Generation and Filtering* (Section 4.4) rolls out agent episodes against the populated servers and keeps only the trajectories that are both verifiably correct and solvable by a capable agent.

### 4\.1 Agentic world modeling

We treat every app in our corpus (Contacts, Calendar, Email, YouTube, Maps, Notes, and Settings) as a world to be modeled directly, rather than as a GUI to be imitated. Each app is specified by two artifacts, authored once and reused across every later stage of the pipeline. The first is a functionality specification: a description of the app’s scope of behavior we want an agent to be able to use – the same document doubles as the scope definition consumed during task generation (Section 4.2). The second is a structured data schema: the app’s tables, their columns, the foreign-key relationships between tables, and, for every column, an explicit synthesis instruction describing how values in that column should be produced – either a hard, constrained sampling rule (e.g. a phone number format, a bounded integer range) or a semantic instruction handed to an LLM when the content needs to look and read like something a person actually wrote (e.g. an email subject line or a note body). From these two artifacts we generate a fully working REST server per app, which becomes the mock target environment used throughout data generation and training (Figure 1).

Critically, the schema is a fixed, shared source of truth: it is authored once per app and is not redesigned for each new task, which is what lets task generation and environment state generation reason about the same tables and columns independently of one another. Also, it is important to mention, that at this stage, the apps are implemented without a concrete state instantiation, as that will be on a task-basis.

### 4\.2 Task generation

We generate the task before conditioning any environment state on it, rather than the other way around. State-first pipelines – which sample a plausible starting state, then ask an LLM to propose a goal consistent with it – only allow partial control of how difficult the task should be. Generating the task first lets us treat difficulty as a direct generation-time choice – for instance, the number of apps a task spans, or the amount of supporting data it requires – rather than an emergent property of whatever state we happened to sample.

Concretely, task generation starts by sampling combinations of apps, from single apps up to a maximum combination arity (currently three), with each combination allotted a fixed sample budget. For each combination, we use a frontier LLM whose prompt consists of general task-writing instructions and the scope definitions (the Markdown specs of Section 4.1) of the apps in that combination, and the set of actions an agent will actually have available when attempting the task.

The full prompts are shared in Appendix B, but there are two parts in the task-writing instructions that we have found to be important for generating sufficiently complex tasks:

- **A complexity taxonomy with anti-patterns.** The prompt defines four explicit control-flow categories – chained, conditional, iterative, and merge – that the agent is encouraged to choose from and combine in the tasks. We also list anti-patterns, for example tasks that look complex but are not, or a “chained” task whose second step never actually consumes the first step’s output.
- **Scenario-first generation.** The prompt instructs the LLM to imagine an internal scenario – a user, a goal, a chain of steps, possible complications – before writing the task, and only then distill it into a single natural-language request. It also requires checking that the resulting task text leaves something for the agent to discover at runtime; a task the agent could act on immediately, without first finding anything out, is rejected as insufficiently deep.

After the initial tasks are generated, we re-phrase them according to different *personas*, representing how the same task might be expressed in different manner by different kinds of users. We also ensure that we use different personas for generating training vs evaluation tasks.

Each candidate is then reviewed by an LLM judge that shares the same task-validity specification as the generator and checks, independently, whether the target is unambiguous, whether the task stays within the stated scope of its app combination, and whether it respects the train/test holdout split. Tasks that fail any of these checks are discarded.

### 4\.3 Environment state generation

Once a task exists, we populate the mock servers with the data it needs – and with data it should *not* need, so that solving the task actually requires using the goal correctly rather than acting on the only plausible-looking row in an otherwise empty database. This happens in two steps. First, for each task, an LLM produces a row plan: for every table it selects (out of all possible database tables), a natural-language description of the rows to add, any constraints on their column values, and any foreign-key links to other planned rows. Rows are explicitly typed as either task-critical (required for the task to be solvable and verifiable) or distractor, with distractors further typed as sibling (same shape as a task-critical row, differing only in the field that would make an agent’s answer wrong), related (plausible but out of scope), or noise (unrelated filler). Second, rather than asking the LLM to generate the actual rows – which risks silently violating the schema’s foreign-key and typing constraints – we batch every row-plan condition across *all* tasks that touch a given table and generate that table’s data in bulk, resolving each row’s foreign keys either from the explicit links produced in the row plan or, where none is specified, by sampling from the pool of rows already generated for that task. This keeps row generation scoped to one table at a time, where schema constraints are easiest to enforce mechanically, while still letting the LLM decide, at the row-plan stage, what the data should look like and why.

### 4\.4 Expert trajectory generation and filtering

For each task we launch a fresh, isolated instance of the relevant app servers, pre-loaded with its generated environment state, and roll out an agent episode against it. Because these mock servers are lightweight, resettable, and trivially parallelizable, we run many such episodes concurrently – across tasks, and, where we want multiple attempts at the same task, within a task – rather than being bottlenecked on a single physical device, shared backend, or memory-intensive emulators.

Each resulting trajectory is scored by an LLM-as-judge pass over the full, numbered sequence of actions and server responses: the judge returns a binary correct/incorrect verdict together with free-text reasoning. The judge’s rubric follows the same notion of success that the Portable Action Layer’s response contract makes checkable (Section 5.2): a state-changing action only counts if it returned status `ok`, since `invalid_input`, `not_found`, `not_supported`, `verification_failed`, and `error` all mean the action had no effect; an information-retrieval goal is only satisfied by an explicit, correct call to the `answer` action, not by reasoning that happens to mention the right fact; and a multi-part goal requires every part to be completed, though an agent that makes and then corrects its own mistake mid-trajectory is not penalized for the detour.

We additionally use this stage to filter the task pool itself. A task is kept only if at least one rollout from a capable, frontier-level agent solves it, so a task that reaches training or evaluation is one we have direct evidence is solvable, not merely one we intended to be. This step is necessary, since the tasks and the initial state are all LLM-generated, and there are no formal guarantees that the tasks are actually solvable.

## \\titlefont**5 \\titlefontHarness**

The harness is the runtime layer the agent interacts with at both data-generation/training time and inference time. We organize it around three points: the *prompt* the agent is run with, including how it discovers available tools (Section 5.1); the *Portable Action Layer* that gives the agent a single, consistent action interface regardless of whether it is acting against a mocked training-time environment or the real, on-device target environment (Section 5.2); and a set of *optional extensions* that can be toggled at inference time without retraining (Section 5.3).

### 5\.1 Prompt

The agent is run as a multi-turn conversation. The system prompt combines a short preamble, a runtime-rendered list of the action schemas exposed by the currently registered action classes, general operating guidance (retry strategies after a failed call, how to handle under-specified or infeasible requests, and location awareness), and a strict response format: every turn must contain a `Reason: ...` field followed by an `Action: {...}` field. Turns then alternate between the assistant emitting an action and the environment returning a response as a user turn. The task goal itself is the first persistent user message. By default, the agent discovers tools instead of having every schema injected up front. The initial prompt lists only the names of the available apps and the agent must explicitly call `get_tools` to retrieve the actions and argument schemas it actually needs. This keeps the context length of a session short, at the cost of one or two extra turns before the agent can act on a new app.

### 5\.2 Abstraction layer

The agent never sees what is behind an action, only a single, uniform action contract: every step is a JSON object naming an action type and its arguments, e.g. `{"action_type": "contacts_search", "query": "Sofia Martinez"}`. Whether a call reaches a mock server or a real app depends entirely on what sits on the other side of the Portable Action Layer. The agent’s prompt, weights, or output format do not need to encode that. This layer enables different tool implementations to happen between training and deployment time.

During data generation and training (Section 4), calls are dispatched through a server manager that keeps a pool of per-task, isolated app-server instances, each pre-loaded with that task’s generated environment state. The manager routes an action’s `action_type` to the right app instance, executes it, and returns a JSON observation. Since every task gets its own instance, many episodes can be rolled out concurrently without one task’s state leaking into another’s, which is what makes the parallel rollouts of Section 4.4 cheap in the first place.

At deployment, the same `action_type`/argument contract is dispatched through a different implementation behind the Portable Action Layer. This translates the call into platform intents, accessibility actions, or an app’s/REST endpoints while returning observations in the same JSON shape and status vocabulary. Because the contract the agent is trained against is identical on both sides, swapping the mocked training-time environment for the real target environment is a change to the implementation behind the Portable Action Layer independent of the agent. Adding support for a new app means registering a new action namespace and implementing it against both backends, without touching the policy or its training data format.

### 5\.3 Additional agentic functionalities

The following extensions sit alongside the agent at inference time. Each is a self-contained runtime toggle: enabling or disabling it requires no change to the trained policy.

#### 5\.3.1 Hybrid AI

In this report, we detail how to build and test an assistant that fits on a handheld device and can operate without relying on frontier LMs hosted on the cloud. Nevertheless, it can be beneficial to allow the assistant to benefit from frontier-level capabilities when dealing with tasks that require them. We enable this through a hybrid-AI extension that adapatively involves cloud compute into the execution of a task, while maintaining chief reliance on the local assistant. There are various methods of involving multiple LMs in the solution of an agentic task, which can be divided into the broad classes of routing \[Zhang et al., 2026; Parashar et al., 2026\], context-guided escalation \[Zhou et al., 2025; Li et al., 2026b\] and multi-agent/sub-agent-based architectures \[Li et al., 2026a; Rainone et al., 2026\]. In our case, we opted for a simple escalation-based approach: we detail it, and present an in-depth study of its performance and behavior, in section 8.6.1.

#### 5\.3.2 Safety screening

Access to app APIs lets an agent act on private information and modify device or app state. The same capabilities can support requests such as disclosing another person’s private messages or disrupting their appointments without authorization. Whether a request should proceed therefore depends on its purpose, effects, and authorization. We consider safety screening of the initial task goal, together with the fixed system instructions, before any app actions.

Existing input guardrails can classify requests according to a specified safety policy \[Inan et al., 2023\]. Running a separate classifier or language-model judge alongside the agent repeats processing of the initial context and may require additional model weights. On-device memory and compute budgets motivate reusing the agent’s own prompt computation for screening \[Cunningham et al., 2025\].

Our approach treats safety screening as an auxiliary prediction performed by the agent itself. A monitoring suffix is appended to the prompt and used to elicit a safety assessment before execution. A textual suffix can elicit this assessment, optionally supplying an explicit safety policy. Alternatively, we learn a suffix of continuous embeddings directly from labeled safe and unsafe requests while keeping the agent’s weights fixed. In both cases, the screening decision uses the agent’s existing output scores, without generating a textual assessment or requiring an additional model.

Screening and task execution reuse the agent’s processing of the original prompt. For accepted requests, generation continues from the original context without processing the original prefix again; the additional computation processes the monitoring suffix. Rejected requests do not proceed to app execution, and the harness is responsible for communicating a refusal to the user. Section 8.6.2 presents the formal method and experimental results.

#### 5\.3.3 Context management

Complex phone tasks accumulate API observations and intermediate decisions that can outgrow an on-device model’s context budget. Retaining this history requires a growing KV cache \[Kwon et al., 2023\], which competes for limited DRAM with model weights, the operating system, and active applications \[Federici et al., 2025\]. The deployment workflow therefore configures the context capacity and cache dimensions during model export to fit the available memory \[Qualcomm, \]. This bounds how much history the agent can process at once, even when a task requires more interactions. Context management addresses this constraint by retaining the information needed to continue the task within a finite context window \[Packer et al., 2023\].

We manage context without retraining the agent by removing or condensing older interaction history. *Pruning* discards selected messages, while *summarization* replaces them with a shorter account intended to retain information needed for subsequent actions. Both preserve the original task and system instructions. Context management starts before the deployment limit is reached and reduces history to a lower target, leaving room for new observations and responses. Recent exchanges or the agent’s earlier decisions can also be retained verbatim.

API interaction makes object identifiers, returned values, and confirmed changes directly available as structured messages. These messages can be retained selectively or condensed into a summary, allowing the agent to continue a long task without carrying every past interaction. A formal description of the proposed methods and supporting empirical results are presented in Section 8.6.3.

## \\titlefont**6 \\titlefontTraining**

The harness in Section 5 provides a common interface for collecting trajectories and executing a learned policy. We train compact language models to act through this interface using two alternatives: supervised fine-tuning on successful expert trajectories and on-policy distillation from a larger teacher. We also describe schema internalization, which uses demonstrations to teach the policy to invoke familiar APIs without first retrieving their schemas.

### 6\.1 Supervised fine-tuning

Supervised fine-tuning (SFT) trains the policy to reproduce expert behavior on the tasks and environments produced by our data-generation pipeline. We first define the imitation objective and the construction of the expert dataset, then give the training recipe and describe how we adapt the demonstrations for schema internalization.

**Preliminaries.**

At step $j$, the policy $\pi_{\theta}$ receives an observation $o_{j}$ and generates an assistant response $y_{j}$ consisting of reasoning tokens followed by an action. The action is executed by the harness, producing the next observation. We write the context as $x_{j}=(o_{1},y_{1},\ldots,o_{j-1},y_{j-1},o_{j})$, with the system instructions, task, and any available tool descriptions included in the initial context. The policy models $\pi_{\theta}(y_{j}\mid x_{j})$, using the same context and response notation as Section 6.2.

Given an expert dataset $\mathcal{D}=\{\tau^{(i)}\}_{i=1}^{N}$, with $J_{\tau}$ assistant responses in trajectory $\tau$, SFT minimizes the negative log-likelihood of those responses. Expanding each response into its $L_{j}$ tokens gives

$$
\mathcal{L}_{\mathrm{SFT}}(\theta)
$$

$$
=-\mathbb{E}_{\tau\sim\mathcal{D}}\left[\sum_{j=1}^{J_{\tau}}\log\pi_{\theta}(y_{j}\mid x_{j})\right]
$$

$$
=-\mathbb{E}_{\tau\sim\mathcal{D}}\left[\sum_{j=1}^{J_{\tau}}\sum_{k=1}^{L_{j}}\log\pi_{\theta}(y_{j,k}\mid x_{j},y_{j,<k})\right].
$$

All assistant response tokens, including the reasoning tokens and the concluding action, contribute to the loss; instructions, task text, and environment observations serve as context. We always train in instruct mode with thinking disabled, while retaining the reasoning tokens in the supervised response.

**Expert data construction.**

High-quality expert trajectories are central to our SFT approach. We start from the tasks, generated environment states, and expert rollouts described in Section 4.4: each rollout executes against fresh, isolated mock app servers populated with the state for its task. This provides demonstrations of multi-step API use together with the observations returned by each action. An LLM judge evaluates the complete sequence of actions and observations to determine whether the task was completed. Its rubric requires successful state changes, explicit answers for information-retrieval goals, and completion of every part of a multi-part request. A corrected intermediate mistake does not by itself invalidate a trajectory. We retain tasks with at least one successful expert rollout and use the trajectories judged successful as the expert dataset $\mathcal{D}$.

**Implementation details.**

We fine-tune Qwen3-4B-Instruct-2507, Qwen3-1.7B, and Qwen3-0.6B with LoRA adapters on all linear layers, using ranks 64, 32, and 16, respectively. In each case, we set $\alpha$ equal to the rank, giving a LoRA scaling factor of one. Training uses the VERL SFT trainer with fully sharded data parallelism (FSDP) on two GPUs, fp32 master weights, gradient checkpointing, and padding-free sequence packing. We optimize with AdamW using $\beta=(0.9,0.999)$, weight decay $0.01$, gradient clipping at $1.0$, and a constant learning rate of $10^{-3}$ with no warmup. Each batch contains 32 trajectories, with a maximum sequence length of 11,084 tokens to accommodate full multi-turn trajectories. We train for three epochs, save checkpoints regularly, and select the checkpoint by validation loss. For the hybrid-thinking Qwen3-1.7B and Qwen3-0.6B checkpoints, we relax the check that chat-template tokenization matches the tokenization of the stored trajectories. Apart from the LoRA rank, the recipe is shared across model sizes and data variants.

**Schema internalization.**

By default, the agent discovers API actions and their argument schemas at runtime. These verbose schemas remain in the episode context, increasing the input length of subsequent model calls. Schema internalization uses SFT to teach the policy to invoke familiar actions directly, reducing the context and interaction costs of discovery. We generate expert trajectories with all action schemas included in the prompt, so the demonstrations contain no discovery calls. Before fine-tuning, we replace that prompt with the discovery-oriented system prompt, which contains more than 3,000 characters of instructions but no action schemas. The prompt still provides a mechanism for discovering APIs, while the demonstrated responses invoke actions directly. Training on these examples encourages the policy to learn the familiar action schemas in its weights and use them without retrieving their definitions. Discovery remains available as a fallback for APIs outside the training distribution. This reduces context length and the number of turns per episode; the empirical effects on task completion and context demand are reported in Section 8.

### 6\.2 On-policy distillation (OPD)

**Preliminaries and objective.**

An agent episode is a sequence of model calls. At call $j$ the policy sees a context $x_{j}$ (task, tool descriptions, earlier actions and observations) and emits an action $y_{j}$. We treat each call as one training sequence. The objective needs no reward, so we do not filter episodes by success. For a student $\pi_{\theta}$ and a teacher $\pi_{T}$, we compare next-token distributions at every prefix $h_{t}=(x_{j},y_{j,<t})$. Storing full teacher distributions over a vocabulary of 150k–250k tokens is not practical. We therefore use a *coarse* distribution over the support $U_{t}=\mathrm{TopK}_{T}(h_{t})\cup\{y_{t}\}$ plus one *tail bucket* $\bot$ that holds the remaining probability mass: $\bar{P}_{t}(v)=\pi_{T}(v\mid h_{t})$ for $v\in U_{t}$ and $\bar{P}_{t}(\bot)=1-\sum_{v\in U_{t}}\bar{P}_{t}(v)$. The student’s $\bar{Q}_{t}$ is defined on the same support. Its tail is computed from the student logits outside $U_{t}$. Both are proper distributions that sum to one. We minimize the generalized Jensen–Shannon divergence, averaged over supervised tokens,

$$
D_{\beta}(\bar{P}_{t},\bar{Q}_{t})=\tfrac{1}{1-\beta}\mathrm{KL}(\bar{P}_{t}\,\|\,M_{t})+\tfrac{1}{\beta}\mathrm{KL}(\bar{Q}_{t}\,\|\,M_{t}),\qquad M_{t}=\beta\bar{P}_{t}+(1-\beta)\bar{Q}_{t}.
$$

Here $M_{t}$ is the mixture of the teacher and student distributions with weight $\beta$. Both distributions are compared against this mixture rather than against each other, so the loss stays finite even where one model gives a token zero probability. The scaling makes the endpoints forward KL ($\beta\!\to\!0$, mode-covering) and reverse KL ($\beta\!\to\!1$, mode-seeking). The coarse distributions are obtained from the full ones by merging all tokens outside $U_{t}$ into one category. Merging categories can only hide differences between two distributions, never create them. By the data-processing inequality, which holds for KL and for $D_{\beta}$, the coarse loss is therefore a lower bound on the full-vocabulary loss. The bound is tight when the student spreads its tail mass over the omitted tokens in the same proportions as the teacher. Unlike truncated top-$k$ distillation, which drops the omitted tokens entirely, the tail bucket still penalizes the student for placing too much mass outside the teacher’s support. We backpropagate the divergence through all categories of $U_{t}\cup\{\bot\}$ directly, not as a per-token reward with a policy-gradient estimator. In *on-policy distillation* (OPD) the student generates the episodes in the environment. The teacher then scores the sampled tokens in a single prefill pass, which gives dense targets on the states the student actually visits. Training proceeds in rounds: sample episodes with the current student, score them with the teacher, update the student. When teacher and student come from the same model family and share a tokenizer, positions and token ids coincide, and the teacher scores the student’s tokens as they are.

**Cross-tokenizer distillation.**

Student and teacher from different model families usually have different tokenizers. In our setting the student has a 151k-token vocabulary and the teacher a 248k-token one. The same text is therefore split into different tokens. For example, the student writes “`.\n\n`” as a single token, while the teacher writes it as “`.`” followed by “`\n\n`”. Token ids no longer identify the same event, so the teacher’s distribution cannot be copied position by position. We work at the level of text instead. Each model reads the conversation in its own chat template, and two tokens are treated as the same category when they decode to the same bytes. Teacher candidates that have no student equivalent go to the tail bucket. Student-only tokens never get explicit probability, so the loss pushes them into the tail.

*On-policy (student episodes).* The student’s sampled text is re-tokenized by the teacher and scored. A position is supervised only when one student token and one teacher token cover exactly the same bytes. Every other position, such as a student token that merges two teacher tokens, is kept as context but gets no loss.

*Off-policy (teacher episodes).* The teacher generates the episode and returns its top-$k$ distribution at every step, and we train with forward KL ($\beta=0$). Each teacher token is converted to student tokens. A token both vocabularies share keeps its soft target. A teacher token the student does not have is spelled out as a sequence of student tokens with one-hot targets, i.e. plain cross-entropy on the teacher’s text. A student token that would merge several teacher tokens is explicitly given near-zero probability.

*Why off-policy first.* In both modes the student is taught to write text in the teacher’s segmentation and to stop using some of its own tokens. It has to relearn part of its vocabulary. Doing this on-policy from the base student fails. Wherever the base student uses one of its own merged tokens, the position has no teacher counterpart and receives no learning signal, so nothing corrects it. In our experiments the output length ran away within two rounds. The off-policy stage avoids this: the teacher’s text provides a target at every position, so the student learns the new segmentation and the task behavior together. We therefore train in two stages. The off-policy stage comes first. The on-policy stage then starts from its weights, when almost every student token already matches a teacher token one-to-one.

**Implementation Details.**

The teacher is Qwen3.8-27B with thinking disabled. The students are Qwen3-4B-Instruct-2507, Qwen3-1.7B and Qwen3-0.6B (thinking disabled). All three are cross-tokenizer pairs and use the two-stage recipe. As a same-tokenizer control, Qwen3.5-4B shares the teacher’s vocabulary and is trained on-policy from the base model ($\beta=0.7$). We train on three environments: API-control (ours, 1808 multi-app tool-use tasks), MobileGym (MG, 4190 generated tasks) and MobileWorld (MW, 2700 tasks). The student is trained with LoRA (rank 128, $\alpha=32$, all linear projections) and AdamW with fp32 state, learning rate $5\cdot 10^{-5}$. Each round collects 1024 episodes at temperature 1 (needed for exact sampling log-probabilities) and takes 16 optimizer steps of 64 episodes. Teacher targets use the top-64 tokens. The off-policy stage runs 10 rounds at $\beta=0$. The on-policy stage at $\beta=0.5$ runs 10 rounds on AppVerse and 20 on MobileGym and MobileWorld. Context is 24k tokens on AppVerse and 16k on MobileGym and MobileWorld. Each run uses 4 GPUs. Student and teacher stay resident as vLLM servers that sleep and wake between the rollout, scoring and training phases, and the teacher uses 2-way tensor parallelism.

## \\titlefont**7 \\titlefontOn-Device Challenges and Implementation**

Deploying FireAnt on a phone introduces three constraints that are absent in simulation: a short, fixed context window, limited memory and decode speed, and on-device APIs that differ from the mock servers used in training. This section describes the deployed system and how it handles these constraints.

**System overview.**

The on-device implementation is a standalone Android application and no PC or `adb` connection is used at run time. The agent loop of Section 5 is ported to TypeScript and runs inside the application in an embedded Node.js runtime and the actions are handled by native Kotlin executors. The model runs on the NPU through Qualcomm’s GenieX SDK \[13\]. The application exposes about 90 actions. All are exported from the same Python action registry that drives training-time dispatch. Parity tests check the on-device port against the training-time harness, so a behavioral difference between the two environments can only come from the tool implementations behind the Portable Action Layer.

**Quantization and export.**

We quantize the Qwen3-4B-Instruct-2507 model to 8-bit weights with 16-bit activations using quantization-aware training (QAT) in Qualcomm’s AI Model Efficiency Toolkit (AIMET) \[3\]. We found QAT, rather than post-training quantization, necessary to preserve tool-argument formatting accuracy at low bit-widths. The quantized model is then transformed for compatibility with the Qualcomm GENIE SDK \[28\] at the PyTorch representation level (handling autoregressive prefill/decode, attention masking, and position embeddings), exported to ONNX with the associated quantization encodings, converted to Qualcomm’s Deep Learning Container format, and compiled for the Hexagon v81 NPU of the Snapdragon 8 Elite Gen 5, with an 8,192-token context. The compiled model is about 4.0 GB of NPU context binaries plus a 0.37 GB embedding table.

**Context budget.**

The whole episode, made up of the system prompt, the goal, every discovery reply, and every action and observation, has to fit into the context. Two design choices keep it there: (i) tool discovery (Section 5.1), without which the tool catalog alone would exceed the context, (ii) compact observations for APIs whose raw responses are large. For example, a raw YouTube Data API search result costs about 1.7k tokens, so the on-device YouTube tools return only identifiers, titles, channels, dates and counts. An overflow is detected either by the runtime rejecting the prompt or when prompt plus output reach the context size. The episode then ends with a dedicated `context_full` status. The context-management extension of Section 5.3.3 is designed to replace this hard stop by compacting the history.

**Latency of multi-step sessions.**

A task requires many sequential model calls, so per-step latency compounds. A model that is fast per call but needs twice as many steps is not faster end to end. This is one of the reasons we track average steps-to-success, not just wall-clock latency per call, when comparing against baselines in Section 8.3. Within a step, the cost is prefill of the new tokens plus decode of the response. The KV cache is kept across the steps of one task and reset at the start of every task. Each step therefore processes only the newest action and observation instead of re-processing the whole conversation.

**On-device Portable Action Layer.**

On the phone, each app’s tools are implemented with the platform’s own APIs or the official Google web APIs. They keep the response contract of Section 5.2. The same JSON envelope and the same status vocabulary. Every write is read back and compared with the request, and a mismatch is reported as `verification_failed` rather than as success. A write that needs a permission the user has not granted returns `not_supported` and names the permission. Signing in to Google services uses the phone’s own Google account, with a separate access token per service and no stored password.

## \\titlefont**8 \\titlefontBenchmarks and Results**

### 8\.1 Benchmarks: MobileWorld, MobileGym, and MobileGym++

**MobileWorld.**

MobileWorld \[Kong et al., 2026\] is a dataset consisting of three task groups: GUI-only tasks (117), Agent-User Interaction tasks (45) and MCP-Augmented tasks (40). All of them are evaluated entirely within an Android emulator. We use this benchmark as an evaluation for our trained models in Section 6 and to compare GUI-based and API-based control on a common set of tasks.

**MobileGym.**

MobileGym \[Wu et al., 2026\] is a browser-hosted simulator for mobile GUI agents, with 28 apps and 416 parameterized task templates. Its official test suite contains 256 tasks, each specifying a goal, an initial app state, and a deterministic success checker. Grounded query tasks require answers to be submitted through the AnswerSheet app.

**MobileGym++.**

MobileGym++ \[Yan et al., 2026\] adds 35 commercial-style apps to MobileGym, for 63 app clients in total. Its 215 released tasks include 106 tasks spanning multiple apps, with workflows involving up to four apps. Programmatic checkers evaluate task completion from the application state.

**Evaluation Protocol.**

For MobileGym and MobileGym++, GUI and API evaluations use the same tasks, task parameters, initial states, and success criteria. We select tasks validated by scripted API executions against the original goal and state-change checks: 251 of the 256 official MobileGym test tasks and 180 of the 215 released MobileGym++ tasks. We evaluate each selected task once with its original step budget and score completion using the original deterministic goal checker.

For these two benchmarks, sampling and thinking settings follow model recommendations for each interface; policy or serving defaults fill unspecified fields. For proprietary models, we request medium reasoning effort and use provider-default sampling. Default per-response limits are 4,096 tokens for MobileGym and 8,192 for MobileGym++, including reasoning, under both interfaces. We record the model and harness settings for each run.

For MobileWorld, GUI evaluation covers all 117 GUI-only tasks. We down-select to 101 tasks that are doable via API operation and do not require screen visual understanding. We let an agent retry a task only when an emulator failure is classified as infrastructure-related. We score both conditions using MobileWorld’s original task evaluators.

**GUI-based evaluation.**

For the three benchmarks, we use released model-specific GUI policies when available and the benchmark’s generic GUI policy otherwise. Agents receive screenshots and issue touch, typing, scrolling, and navigation actions, in the original simulators for MobileGym and MobileGym++ and in the original Android emulator for MobileWorld. We retain each policy’s prompts, action format, and screenshot history when possible.

For MobileWorld, GUI episodes have a 50-step budget, a 3-second post-action wait, and a 1800-second timeout, and we use model-specific sampling, thinking, and output-token settings, following published recommendations where available and recording harness defaults for unspecified settings. We use seed 0 for generation.

**API-based evaluation.**

We implemented the MobileGym and MobileGym++ API layers by analyzing the original app code, data stores, and GUI workflows. The layers expose reusable app operations through the action contract of Section 5.2, using the original simulators and incorporating native tools where available. Models use our common agent loop and the conversation format of Section 5.1: they receive an app list, discover tools through `get_available_tools(app_name)`, and issue structured calls. We retain the full interaction history.

For MobileWorld, we implemented an API layer for the downselected tasks by analyzing how apps behave and how they alter the state of the emulator. This API layer consists of ADB commands and native app/backend interfaces that act inside the Android emulator provided by MobileWorld, and mimic the app operations. Similar to MobileGym/MobileGym++, this layer abides by the action contracts of Section 5.2. Models use a common agent loop and the conversation format of Section 5.1: they receive an app list, discover tools through `get_available_tools(app_name)`, and issue structured calls. We retain the full interaction history. API episodes have a limit of 100 agent turns and a 3600-second timeout, and requests use model or serving defaults, without sampling, reasoning, or generation-limit overrides.

### 8\.2 Custom Dataset: AppVerse

To demonstrate the real-world applicability of our framework, we used it to deploy a phone-control agent to an Android device. On the device, the agent’s objective was to control the following applications: Contacts, Calendar, Gmail, YouTube, Google Maps, Notes, and Settings.

We generate and evaluate this dataset entirely against the mock target environment of Section 4.1 – the FastAPI servers for Contacts, Calendar, Email, YouTube, Maps, Notes, and Settings – rather than against the physical device.

Tasks are generated with the app-combination sampling scheme of Section 4.2, spanning arities one through three over these seven apps – 63 valid combinations in total. Single-app tasks account for only around 14% of the dataset; the remainder requires chaining calls across two (around 37%) or three (around 49%) apps, reflecting that realistic phone goals rarely stay within a single app. Task phrasing is further diversified by drawing from 16 distinct user personas during generation.

Our dataset contains 4,553 tasks – 3,742 train and 811 test – retained from 5,860 candidates after the generation and judging pipeline of Section 4.2. GPT-5.4 is used as the LLM throughout: task generation, row planning, synthetic data generation, test generation, and judging all run on the same model. Using the LLM judge evaluations, we finally filter down to 1,808 train, 250 validation and 455 test samples.

**Train/test split.**

The split is constructed to probe generalization along two axes while holding everything else – the app suite, the API surface, and the action schemas – identical between train and test. First, we hold out personas: each of the 16 personas is assigned exclusively to one split, so phrasing style at test time is never seen during training. Second, we hold out topics: test tasks are restricted to finance and travel as subject matter, both explicitly excluded from train generation. Together, these holdouts mean the test split measures whether the agent’s API-interaction skill transfers to unfamiliar phrasing and unfamiliar real-world topics, rather than whether it has memorized surface-level task patterns.

**Task complexity categories.**

We designed the data generation pipeline to ensure that the resulting tasks are complex enough to be useful in a real deployment setting. To quantify complexity, we introduce multiple complexity categories:

- **Chained** – the output of one action is the explicit input to the next, e.g. “Add the latest video from the Qualcomm channel to my watch later” (needs finding the latest video, and then adding it to an other list)
- **Conditional** – a state check determines which of several branches to take, e.g. “if I have any meeting tomorrow before 9am, set an alarm for 7am, otherwise for 8.”
- **Iterative** – a set of elements is discovered via a non-trivial filter, then acted on element by element, e.g. “follow all artists who sang a song I liked.”
- **Merge** – information is read from two or more sources, compared or reconciled, and the outcome drives an action, e.g. “check if my dentist’s saved address matches their last email, correct whichever is wrong.”

A task can be flagged under more than one category at once – for instance, an iterative task whose per-element action is itself conditional. We measure the complexity of our dataset according to these categories in Figure 2, which reports how prevalent each category is, and Figure 3, which reports the distribution of the number of categories flagged per task.

![Figure](figures/f3-prevalence-per-category.png)

Figure 2: **Prevalence of each complexity category.** Fraction of tasks in our dataset flagged to be in each of the four complexity categories above.

![Figure](figures/f4-flag-count-histogram.png)

Figure 3: **Distribution of complexity flags per task.** Fraction of tasks flagged under 0, 1, 2, 3, or all 4 complexity categories simultaneously.

### 8\.3 Results

Table 1: **Overall - MobileWorld.** Generated tokens (including reasoning) and turns are means over all episodes. Peak CL is the 80th percentile of episode peak context length, in tokens.

| Model | Variant | Interface | Success Rate (%) | \# Gen. Tokens (mean) | Peak CL (p80) | \# Turns (mean) |
|---|---|---|---|---|---|---|
| **Proprietary models** |  |  |  |  |  |  |
| GPT | 6\.1-sol |  | 65\.5 | 672 | 8,717 | 18\.6 |
|  | 6-luna |  | 39\.3 | 3,621 | 10,374 | 28\.1 |
|  | 5\.5 |  | 58\.4 | 4,700 | 10,533 | 26\.0 |
| Claude | Opus 5.5 |  | 67\.5 | 2,282 | 8,324 | 20\.5 |
|  | Sonnet 5.5 |  | 59\.0 | 2,194 | 357 | 23\.7 |
| **Open-weight models** |  |  |  |  |  |  |
| Qwen3-VL | 2B |  | 6\.9 | 2,706 | 4,490 | 22\.1 |
|  | 4B |  | 8\.6 | 2,571 | 4,518 | 25\.2 |
|  | 8B |  | 9\.5 | 3,024 | 4,572 | 27\.4 |
|  | 32B |  | 13\.8 | 3,308 | 4,721 | 27\.5 |
| Qwen3.5 | 2B |  | 6\.0 | 2,868 | 13,511 | 38\.6 |
|  | 4B |  | 12\.9 | 2,698 | 10,603 | 16\.4 |
|  | 9B |  | 12\.9 | 4,871 | 14,630 | 19\.1 |
|  | 27B |  | 33\.3 | 5,540 | 13,372 | 29\.0 |
|  | 35B-A3B |  | 18\.9 | 4,780 | 13,472 | 22\.9 |
| Gemma 4 | 2B |  | 0\.9 | 1,302 | 3,700 | 11\.2 |
|  | 4B |  | 2\.6 | 1,453 | 4,097 | 11\.7 |
|  | 31B |  | 28\.7 | 1,192 | 4,273 | 18\.8 |
|  | 26B-A4B |  | 10\.4 | 2,776 | 4,574 | 16\.9 |
| **Open-weight GUI models** |  |  |  |  |  |  |
| UI-Venus-1.5 | 2B |  | 7\.8 | 3,475 | 7,153 | 34\.3 |
|  | 8B |  | 12\.9 | 3,685 | 7,173 | 34\.9 |
|  | 30B-A3B |  | 17\.4 | 3,770 | 8,119 | 31\.4 |
| UI-Venus-2 | 9B |  | 22\.4 | 3,741 | 13,881 | 11\.3 |
| GUI-Owl-1.5 | 2B |  | 23\.7 | 1,941 | 4,751 | 37\.6 |
|  | 4B |  | 27\.0 | 2,198 | 4,840 | 37\.8 |
|  | 8B |  | 33\.3 | 1,935 | 4,772 | 35\.6 |
|  | 32B |  | 36\.6 | 2,008 | 4,793 | 36\.9 |
| MAI-UI | 2B |  | 11\.3 | 2,244 | 11,228 | 40\.6 |
|  | 8B |  | 22\.4 | 2,456 | 11,505 | 38\.2 |
| OpenMobile2 | 9B |  | 35\.7 | 2,149 | 13,293 | 25\.0 |
|  | 27B |  | 42\.1 | 2,393 | 13,565 | 28\.9 |
| MAI-Gym | 9B |  | 16\.4 | 6,218 | 12,638 | 14\.0 |
| UI-TARS-1.5 | 7B |  | 1\.7 | 2,882 | 16,711 | 23\.3 |
| **FireAnt** |  |  |  |  |  |  |
| Qwen3+FireAnt | 4B |  | 47\.5 | 748 | 16,190 | 10\.4 |
|  | 1\.7B |  | 20\.8 | 905 | 15,190 | 15\.1 |
|  | 0\.6B |  | 9\.9 | 1,020 | 12,295 | 16\.7 |

: GUI; : API. Success rate: low $\rightarrow$ middle $\rightarrow$ high. Darker blue denotes larger token, context, and turn counts. Color scales are clipped at the 10th and 90th percentiles per metric and table; displayed measurements are not clipped. Shading indicates magnitude, not statistical significance.

Table 2: **GUI vs. API - MobileWorld.** Generated tokens (including reasoning) and turns are means over all episodes. Peak CL is the 80th percentile of episode peak context length, in tokens. GUI and API solve identical tasks under the same evaluation criteria.

| Model | Variant | Success Rate (%) |  | \# Gen. Tokens (mean) |  | Peak CL (p80) |  | \# Turns (mean) |  |
|---|---|---|---|---|---|---|---|---|---|
| **Proprietary models** |  |  |  |  |  |  |  |  |  |
| GPT | 6\.1-sol | 65\.8 | 85\.1 | 672 | 402 | 8,717 | 9,744 | 18\.8 | 8\.2 |
|  | 6-luna | 39\.3 | 70\.3 | 3,621 | 900 | 10,374 | 9,127 | 28\.1 | 6\.3 |
|  | 5\.5 | 58\.4 | 79\.2 | 4,700 | 1,138 | 10,533 | 6,409 | 26\.0 | 9\.0 |
| Claude | Opus 5.5 | 67\.5 | 85\.1 | 2,282 | 991 | 8,324 | 15,531 | 20\.5 | 8\.5 |
|  | Sonnet 5.5 | 59\.0 | 86\.1 | 2,194 | 1,571 | 357 | 16,576 | 23\.7 | 8\.0 |
| **Open-weight models ($\geq$ 27B total parameters)** |  |  |  |  |  |  |  |  |  |
| Qwen3-VL | 32B | 13\.8 | 52\.5 | 3,308 | 678 | 4,721 | 10,431 | 27\.5 | 8\.0 |
| Qwen3.5 | 27B | 33\.3 | 85\.1 | 5,540 | 1,880 | 13,372 | 13,056 | 29\.0 | 9\.8 |
|  | 35B-A3B | 18\.9 | 71\.3 | 4,780 | 1,846 | 13,472 | 15,701 | 22\.9 | 10\.5 |
| Gemma 4 | 31B | 28\.7 | 82\.2 | 1,192 | 869 | 4,273 | 13,149 | 18\.8 | 9\.1 |
| **Open-weight models (6B $<$ total parameters $<$ 27B)** |  |  |  |  |  |  |  |  |  |
| Qwen3-VL | 8B | 9\.5 | 27\.7 | 3,024 | 829 | 4,572 | 10,586 | 27\.4 | 12\.5 |
| Qwen3.5 | 9B | 12\.9 | 69\.3 | 4,871 | 2,327 | 14,630 | 13,138 | 19\.1 | 9\.8 |
| Gemma 4 | 26B-A4B | 10\.4 | 63\.4 | 2,776 | 1,019 | 4,574 | 15,347 | 16\.9 | 11\.8 |
| **Open-weight models ($\leq$ 6B total parameters)** |  |  |  |  |  |  |  |  |  |
| Qwen3-VL | 2B | 6\.9 | 5\.0 | 2,706 | 5,959 | 4,490 | 17,216 | 22\.1 | 54\.3 |
|  | 4B | 8\.6 | 26\.7 | 2,571 | 515 | 4,518 | 7,234 | 25\.2 | 6\.6 |
| Qwen3.5 | 2B | 6\.0 | 4\.0 | 2,868 | 9,515 | 13,511 | 27,592 | 38\.6 | 43\.3 |
|  | 4B | 12\.9 | 57\.4 | 2,698 | 2,568 | 10,603 | 14,574 | 16\.4 | 11\.6 |
| Gemma 4 | 2B | 0\.9 | 18\.8 | 1,302 | 846 | 3,700 | 7,498 | 11\.2 | 9\.0 |
|  | 4B | 2\.6 | 42\.6 | 1,453 | 781 | 4,097 | 10,288 | 11\.7 | 6\.9 |
| Qwen3 | 4B |  | 21\.8 |  | 617 |  | 9,048 |  | 5\.0 |
|  | 1\.7B |  | 4\.0 |  | 708 |  | 34,302 |  | 10\.3 |
|  | 0\.6B |  | 0\.0 |  | 538 |  | 34,253 |  | 14\.9 |
| **FireAnt** |  |  |  |  |  |  |  |  |  |
| Qwen3+FireAnt | 4B |  | 47\.5 |  | 748 |  | 16,190 |  | 10\.4 |
|  | 1\.7B |  | 20\.8 |  | 905 |  | 15,190 |  | 15\.1 |
|  | 0\.6B |  | 9\.9 |  | 1,020 |  | 12,295 |  | 16\.7 |

: GUI; : API. Success rate: low $\rightarrow$ middle $\rightarrow$ high. Darker blue denotes larger token, context, and turn counts. Color scales are clipped at the 10th and 90th percentiles per metric and table; displayed measurements are not clipped. Each GUI/API pair shares one color scale. Shading indicates magnitude, not statistical significance. Variant notation reports total parameters and, for MoE variants, active parameters after “A''; size subgroups use total parameters.

Table 3: **Training - AppVerse.** Generated tokens (including reasoning) and turns are means over all episodes. Peak CL is the 80th percentile of episode peak context length, in tokens. Evaluation uses a separate out-of-distribution test split.

| Model | Variant | Interface | Success Rate (%) | \# Gen. Tokens (mean) | Peak CL (p80) | \# Turns (mean) |
|---|---|---|---|---|---|---|
| **Reference model** |  |  |  |  |  |  |
| GPT | 5\.4 |  | 100\.0 | 436 | 8,546 | 7\.4 |
| **Open-weight models ($\geq$ 27B total parameters)** |  |  |  |  |  |  |
| Qwen3.8 | 27B |  | 89\.7 | 1,386 | 9,656 | 8\.0 |
| Qwen3.5 | 27B |  | 84\.8 | 1,715 | 9,729 | 7\.7 |
| Gemma 4 | 31B |  | 85\.5 | 651 | 9,308 | 7\.5 |
| **Open-weight models ($\leq$ 6B total parameters)** |  |  |  |  |  |  |
| Qwen3.5 | 4B |  | 46\.6 | 2,220 | 9,568 | 9\.4 |
|  | 2B |  | 2\.2 | 752 | 7,950 | 3\.6 |
|  | 0\.8B |  | 0\.0 | 1,671 | 3,979 | 10\.2 |
| **FireAnt** |  |  |  |  |  |  |
| Qwen3+FireAnt | 4B / Baseline |  | 29\.7 | 671 | 8,180 | 5\.5 |
|  | 4B / SFT |  | 73\.8 | 492 | 8,961 | 7\.6 |
|  | 4B / OPD |  | 78\.0 | 638 | 9,248 | 7\.7 |
|  | 4B / SFT+I |  | 65\.5 | 361 | 3,761 | 5\.5 |
|  | 4B / OPD+I |  | 80\.2 | 602 | 4,554 | 5\.8 |
|  | 1\.7B / Baseline |  | 5\.3 | 586 | 7,985 | 7\.6 |
|  | 1\.7B / SFT |  | 53\.1 | 425 | 8,865 | 7\.3 |
|  | 1\.7B / OPD |  | 60\.0 | 652 | 9,039 | 7\.9 |
|  | 1\.7B / SFT+I |  | 53\.5 | 386 | 3,969 | 5\.8 |
|  | 1\.7B / OPD+I |  | 57\.6 | 659 | 4,876 | 6\.7 |
|  | 0\.6B / Baseline |  | 0\.2 | 384 | 25,166 | 9\.5 |
|  | 0\.6B / SFT |  | 39\.8 | 637 | 8,709 | 7\.5 |
|  | 0\.6B / OPD |  | 44\.2 | 733 | 9,351 | 8\.2 |
|  | 0\.6B / SFT+I |  | 34\.1 | 518 | 4,305 | 5\.8 |
|  | 0\.6B / OPD+I |  | 38\.9 | 618 | 4,637 | 7\.3 |

: GUI; : API. Success rate: low $\rightarrow$ middle $\rightarrow$ high. Darker blue denotes larger token, context, and turn counts. Color scales are clipped at the 10th and 90th percentiles per metric and table; displayed measurements are not clipped. Shading indicates magnitude, not statistical significance. GPT-5.4 solves 100% by construction (see Section 4.4). Baseline denotes the base checkpoint without FireAnt training. SFT and OPD are separate training alternatives; OPD does not follow SFT. “+I'' denotes schema internalization.

We evaluate how interface choice and training affect task completion and inference cost. We first compare FireAnt with GUI agents on MobileWorld and MobileGym, then examine paired GUI/API results across all three benchmarks. Finally, we evaluate SFT, OPD, and schema internalization on the out-of-distribution AppVerse test split to assess small API agents’ accuracy and context requirements.

**Baselines and Models**

The GUI baselines comprise proprietary models (GPT-6.1-sol, the GPT-6-luna, GPT-5.5, Claude Opus 5.5, and Claude Sonnet 5.5), general-purpose open-weight models (Qwen3-VL, Qwen3.5, and Gemma 4), and models fine-tuned for GUI control (UI-Venus-1.5 \[Venus Team et al., 2026b\], UI-Venus-2, GUI-Owl-1.5, MAI-UI \[Zhou et al., 2025\], OpenMobile2, MAI-Gym, and UI-TARS-1.5). The interface comparison additionally evaluates general-purpose models through structured tool calls, including API-only Qwen3 baselines. FireAnt uses Qwen3 backbones \[Yang et al., 2025\] with 4B, 1.7B, and 0.6B parameters. For MobileWorld and MobileGym, we use the OPD checkpoints for evaluating the 4B model and SFT checkpoints for the 1.7B and 0.6B FireAnt models. For AppVerse, we use OPD checkpoints for all FireAnt models.

**Metrics**

*Success rate* is the percentage of episodes that satisfy the benchmark’s task-completion criterion. *Generated tokens* counts all tokens emitted by the policy during an episode, including reasoning tokens. *Turns* counts policy responses during interaction with the environment. We report generated tokens and turns as means over all episodes, including failures. Interpret these averages jointly with success: early termination can produce low counts.

*Peak context length* is the largest context length attained within an episode; we report its 80th percentile (p80) across episodes. API agents retain all actions and observations, so their history grows throughout execution. GUI context retention depends on the harness, which may keep only a limited number of screenshots. Token counts depend on each model’s tokenizer and observation representation; device latency and memory require separate measurements.

#### 8\.3.1 GUI agents

![Figure](figures/f5-results-1-overall.svg)

Figure 4: **Success rate versus generation cost on MobileWorld and MobileGym.** Selected open-weight GUI models are compared with FireAnt, which uses API interaction. Generated tokens are means over all episodes, including reasoning; annotations indicate model sizes and variants.

Proprietary models establish a substantial lead in GUI task completion (Tables 1 and 8). Claude Opus 5.5 leads on MobileWorld at 67.5%, while GPT-6.1-sol leads on MobileGym at 80.9%. The strongest open-weight GUI specialists trail these results by 25.4 and 25.5 percentage points, respectively.

Increasing the size of a general-purpose multimodal model improves GUI performance without closing this gap. Qwen3.5-27B is the strongest general-purpose open-weight GUI model on both benchmarks, yet completes only 33.3% and 36.7% of tasks, respectively. Smaller variants combine low completion rates with substantial interaction costs: Qwen3-VL-8B, for example, succeeds on 9.5% of MobileWorld tasks while averaging 27.4 turns. Scaling alone leaves a poor trade-off between task completion and inference work, motivating specialization for GUI control.

GUI fine-tuning improves this trade-off for several models, but its benefits vary across benchmarks. GUI-Owl-1.5-32B combines higher MobileWorld success with fewer generated tokens than the general-purpose 32B Qwen3-VL model. UI-Venus-2 reaches 40.6% on MobileGym, compared with 15.1% for the general-purpose Qwen3.5-9B model. However, specialist rankings change sharply: MAI-Gym reaches 55.4% on MobileGym but 16.4% on MobileWorld. Such variation limits conclusions from a single benchmark, while acquiring GUI trajectories retains the device or emulator interaction costs discussed in Section 4. The mock environments provide a reusable framework for training directly on structured app actions.

FireAnt achieves a competitive success–cost trade-off with a 4B policy (Figure 4). On MobileWorld, it exceeds OpenMobile2-27B in success rate (47.5% versus 42.1%) while generating about one third as many tokens. On MobileGym, it trails that model by 8.0 percentage points (43.0% versus 51.0%) while using fewer generated tokens (1,601 versus 2,241) and turns (14.5 versus 22.8). These comparisons combine training and interface differences; we next examine API gains.

![Figure](figures/f6-results-2-gui-vs-api.svg)

Figure 5: **Paired GUI and API performance across three benchmarks.** Each point compares a model’s success rate (top) or mean generated tokens (bottom) under the two interfaces. Points above the diagonal have higher API success; points below it generate fewer tokens with the API. Token axes use logarithmic scales. Blue dashed lines mark FireAnt API results where available.

#### 8\.3.2 GUI and API interaction

The paired comparison keeps the task and evaluation criterion fixed while changing how the model acts. We use the original MobileWorld, MobileGym, and MobileGym++ tasks; the API agent issues tool calls for the relevant app operations in place of GUI actions. Figure 5 summarizes the paired success rates and generation costs across the three benchmarks. Table 2 reports the full MobileWorld comparison; the MobileGym and MobileGym++ tables are in Appendix A (Tables 9 and 10).

API interaction improves success for most models, including those already strong at GUI control. Among the 18 models with results for both interfaces, success increases for 16 on MobileWorld, 16 on MobileGym, and 17 on MobileGym++. GPT-6.1-sol is a proprietary exception on MobileGym, where API success is 79.3% versus 80.9% with GUI interaction. Large open-weight models approach proprietary API performance on MobileWorld: Qwen3.5-27B reaches 85.1%, about one percentage point below the strongest proprietary API result. The effect also extends to small models: Qwen3.5-4B improves from 7.8% to 35.6% on MobileGym++. However, Qwen3.5-2B remains at or near zero with the API across the benchmarks. Structured actions remove a substantial interaction burden, but effective tool use still requires a sufficiently capable policy.

API interaction also reduces generation and the number of policy turns. Across paired models with available token measurements, the median GUI/API ratio of mean generated tokens is 2.2 on MobileWorld, 4.1 on MobileGym, and 3.0 on MobileGym++; the corresponding median turn ratios are 2.2, 3.8, and 3.7. A structured call can express an app operation that otherwise requires several GUI actions, which is consistent with these reductions. Their coexistence with higher success for most models makes the API gains more compelling than low token or turn counts alone.

Fewer turns do not consistently imply a smaller context. On MobileWorld, Gemma 4-31B roughly halves its mean turn count with the API, yet its p80 peak context rises from 4,273 to 13,149 tokens. API agents can accumulate tool schemas and observation history even when they act efficiently, whereas GUI harnesses may discard earlier screenshots. This distinction motivates training policies that both use structured actions effectively and reduce the context required to identify those actions.

### 8\.4 Training

![Figure](figures/f7-results-3-appverse-training.svg)

Figure 6: **AppVerse accuracy, generation cost, and context demand.** OPD-trained FireAnt policies with and without schema internalization are compared with base checkpoints and reference models. The panels plot success against mean generated tokens (left, logarithmic axis) and p80 peak context length (right). “+I” denotes schema internalization. The dashed vertical line marks the 8,192-token device context (Section 7).

**Setup**

We train Qwen3 policies with 4B, 1.7B, and 0.6B parameters on AppVerse, using Qwen3-4B-Instruct-2507 for the 4B backbone. We compare two separate training alternatives. SFT uses successful GPT-5.4 trajectories collected and filtered through the pipeline of Section 4.4; OPD uses Qwen3.8-27B as the teacher and does not follow SFT. Evaluation uses a separate out-of-distribution test split, so Table 3 measures transfer beyond the training data.

**Task completion.**

Both training alternatives substantially improve API task completion, with OPD consistently exceeding SFT across model sizes. The 4B policy rises from 29.7% without FireAnt training to 73.8% with SFT and 78.0% with OPD; the latter narrows the gap to the 27B OPD teacher to 11.7 percentage points. At smaller sizes, OPD reaches 60.0% for 1.7B and 44.2% for 0.6B, demonstrating useful task completion even where the base policies solve few tasks. However, the trained policies with tool discovery have p80 peak contexts of roughly 8.7K–9.4K tokens, leaving substantial context pressure for deployment (Figure 6).

**Schema internalization.**

Schema internalization targets the context cost of discovering tool definitions. We train the policy to use the app schemas without retrieving them through tool discovery at inference time; these variants are marked “+I” in Table 3. Across model sizes and training alternatives, internalization reduces p80 peak context by 46–58% and lowers the mean number of turns. For 4B OPD, peak context falls from 9,248 to 4,554 tokens while success rises from 78.0% to 80.2%. The accuracy effect varies: 4B SFT loses 8.3 percentage points, and the smaller OPD policies also lose some success. A p80 context statistic alone does not establish that every episode fits a fixed device budget. The 4B OPD+I policy preserves the strongest trained completion rate while approximately halving context demand relative to 4B OPD.

### 8\.5 On-Device Results

We take the trained model on AppVerse of Section 8.2, quantize and export it following the pipeline described in Section 7, and deploy it on a phone with a custom application. The application exposes the action API for the seven apps covered by AppVerse (Contacts, Calendar, Email, YouTube, Maps, Notes, and Settings), accepts a natural-language query, and dispatches it to the on-device policy to resolve into the corresponding sequence of API calls. Example queries handled end-to-end by the deployed system include:

- *Turn on color inversion to help me see better while driving, then navigate to the nearest supermarket.*
- *Please find the stored address for Carlos Mendoza and create a confirmed event called ‘Taxi to Carlos Mendoza’ on 2026-12-04 from 08:15 to 08:45 whose location is that saved address.*
- *Look up the newest email from my math teacher and if he mentions a video to watch, schedule ‘learn math’ on 2026-11-24 from 20:30 to 21:30 and write the video title in the description.*
- *Collect the 3 latest videos from the Qualcomm channel into a private playlist for me. Then play the first one at half speed.*
- *Search for museums in Amsterdam, pick 3 museums with 4.5+ rating and create a note ‘Amsterdam travel plan’ with their addresses and ratings.*

Each of these queries chains several API calls across one or more of the seven apps (e.g. a Contacts lookup feeding a Calendar event’s location, or an Email lookup feeding a Calendar event’s description), exercising the same compositional, cross-app structure used during training.

### 8\.6 Additional Agentic Functionalities

In Section 5.3, we discussed three additional agentic functionalities with which we equip our framework. Here, we instantiate these functionalities and evaluate their effectiveness in representative agentic settings. For each functionality, we describe the concrete implementation used in our experiments and report the resulting performance.

#### 8\.6.1 Hybrid AI

**Architecture.**

Our hybrid-AI architecture follows an escalation-based pattern, similar to the one used in reference \[Zhou et al., 2025\]. Once a task is given to the Local Agent, execution always begins locally. At every agentic turn, a *Verifier* LM reviews the agent’s actions so far, and, based on that, decides whether execution can continue locally or should be escalated to a *Cloud-based Agent*. If the Verifier issues an escalation call, it appends a message containing corrections and/or feedback at the end of the trajectory (as an extra user turn), which is then taken over by the Cloud-based Agent until execution terminates; otherwise, execution continues locally. We wish to emphasize that, unless an escalation happens, *there is no interaction between Agent and Verifier*, and that, once a task has been escalated, *its execution never reverts to the Local Agent*.

In appendix D, we provide the prompt template used by the verifier. The Verifier and the Cloud Agent could in principle be different LMs; however, we opted to instantiate them both with GPT-5.4.

**Main results.**

In table 4, we evaluate the performance of the Hybrid AI architecture described in the previous paragraph. We compare it with a baseline (the device-only setup) and a ceiling (the cloud-only setup). We evaluate over the test split of AppVerse (Section 8.2), and use the same judge-based task-completion metric (with GPT-5.4 as judge) as the other evaluations presented in this section.

|  | **Task completion (judge: GPT-5.4)** |  |  |  | **Escalation rate** |
|---|---|---|---|---|---|
|  | ALL | 1-app | 2-app | 3-app |  |
| Fully local | 78\.7% | 82\.0% | 78\.0% | 77\.8% | NA |
| Fully on cloud (GPT-5.4) | 91\.2% | 89\.9% | 93\.0% | 90\.0% | NA |
| Hybrid | 84\.6% | 88\.8% | 84\.9% | 82\.2% | 31\.4% |

Table 4: Main results comparing device-only execution with cloud-only execution and our hybrid escalation setup on our custom benchmark (section 8.2).

We can see that the hybrid setup escalates 31.4% of the trajectories, while getting the performance halfway to the ceiling given by the cloud-only setup, with a gain uniformly distributed across all three arity classes. A “perfect” verifier would be able to completely capture the headroom between device- and cloud-only setups; in the next two paragraphs, we report additional analyses to shed light on why this is not the case. We focus on two aspects: how reliable is the verifier in flagging trajectories that fail in the device-only setup, and how much these trajectories end up benefiting from the escalation.

**Verifier accuracy.**

In this paragraph we examine the accuracy of the verifier in flagging trajectories that fail in the device-only setup, and would therefore most benefit from escalation to the cloud. Since most trajectories succeed when run locally, we model the problem as binary classification on an imbalanced dataset, in which a “true positive” decision is a decision to escalate a trajectory that fails locally, irrespective of whether it succeeds on the cloud. In table 5, we report the false positive (trajectory escalated, but had succeeded locally), and the false negative (trajectory was not escalated, but had failed locally) rates, accuracy (the trajectory was failing and was correctly flagged for escalation), precision (the fraction of escalated trajectories that had indeed failed locally) and recall (the fraction of locally failing trajectories that was flagged by the verifier).

| **False positive** | **False negative** | **Accuracy** | **Precision** | **Recall** | **Lift vs chance** |
|---|---|---|---|---|---|
| 17\.4% | 7\.3% | 75\.4% | 44\.8% | 66\.0% | \+14.7% |

Table 5: Verifier accuracy metrics on the 455 test split (the same used to obtain the results in table 4). The “Lift vs chance” figure is by how much the verifier outperforms a verifier that escalates trajectories randomly with a probability equal to the verifier’s escalation rate (31.4%).

We can see that in general, the verifier is more accurate than chance but it nevertheless has a tendency to err on the side of caution and escalate trajectories that might have succeeded even without escalation, resulting in low precision, and more false positives than false negatives. We can also see that its recall is far from 100%: 34% of the trajectories that had failed in the device-only setup were not picked up by the verifier in the hybrid setup. Given that, with the inference setting we use, the behavior of the agent is non-deterministic, a perfect recall score would not be a fair expectation. Nevertheless, the score partially explains why the hybrid setup does not completely close the gap with the cloud-only one.

**The effect of escalation.**

Once the verifier chooses to escalate a trajectory, and assuming that the trajectory was indeed failing, it is still not guaranteed that the cloud model can rescue it. In table 6, we analyze how often this happens.

We define *four* classes of tasks:

- 79 task that succeeded in the edge-only setup, but were nevertheless flagged by the verifier in the hybrid one
- 64 tasks that failed in the edge-only setup and were flagged by the verifier in the hybrid one.
- 279 tasks that succeeded in the edge-only setup, and were not flagged by the verifier in the hybrid one
- finally, 33 tasks that had failed in the edge-only setup, but were nevertheless not flagged in the hybrid setup.

Within each of these four classes, a task can flip from failure to success, or vice-versa. This is what we report in table 6; we wish to emphasize that if a task fails in the edge-only setup, this does not guarantee that it would fail in the hybrid one, *even if the verifier never touches it*. Agent behavior is not deterministic across runs, but for the sake of this analysis, we are deliberately making the simplifying assumption that it is.

| **Escalated** |  | **Never escalated** |  | **Net verifier improvement** |
|---|---|---|---|---|
| Succ $\rightarrow$ Fail | Fail $\rightarrow$ Succ | Succ $\rightarrow$ Fail | Fail $\rightarrow$ Succ |  |
| 20\.3% (16/79) | 34\.4% (22/64) | 1\.1% (3/279) | 72\.7% (24/33) | \+6 |

Table 6: How an escalation decision impacts trajectory success (two leftmost columns). We provide a “control group” by reporting the same metrics on trajectories not touched by the verifier (two rightmost columns). Be aware that the percentages *are not supposed to add up* within column groups, as they come from different populations and therefore have different denominators. The net verifier improvement is simply the difference between escalated-fixed and escalated-broke (22-16): we do not count the 21 trajectories that flipped from failure to success without being touched by the verifier.

We can see that our escalation setup can both fix trajectories that had failed, and end up breaking trajectories that had succeeded (again, this does not mean that they were also succeeding in the hybrid run), but achieves a net improvement overall: when the verifier chooses to intervene, it fixes more tasks than it breaks, which leads to the performance improvement over edge-only reported in table 4.

We conclude this section with a comment on the counterintuitive observation that, of the 33 tasks that had failed locally but were not flagged by the verifier during the hybrid run, 24 (i.e. 72.7%) flip from failure to success, *without verifier intervention*. Since these flips can only be due to agent non-determinism, it would be reasonable to expect the same rate of flips from success to failure. This is incorrect, however, since there is a significant *sampling bias* on those 33 tasks: those tasks had failed in the local run, and yet were judged positively *at every turn* during the hybrid run: they are therefore much more likely to be borderline tasks that the edge-only setup can in principle solve, and are therefore more likely to flip to success due to non-determinism. Overall, one would expect tasks not flagged by the verifier to be biased toward success.

#### 8\.6.2 Safety screening

To instantiate the safety-screening framework described in Section 5.3.2, we evaluate two text-based monitoring suffixes and a learned monitoring suffix.

**Suffix-based readout.**

A textual suffix can elicit an assessment through the agent’s existing language-model output head \[Tillman and Mossing, 2025\]. Our *short prose suffix* baseline appends “Proceeding with the current request is” after the native assistant header, and reads the next-token scores for `allowed` and `blocked` as allow/refuse labels. The *prose policy suffix* baseline supplies explicit assessment rules before its final sentence. This use of binary decision-token scores is analogous to $P(\mathrm{True})$ self-evaluation \[Kadavath et al., 2022\], applied here to whether the request may proceed. Both baselines obtain the score without decoding a textual assessment.

**Learned monitoring suffix.**

We learn screening behavior directly from labeled safe and unsafe requests by optimizing a sequence of continuous embeddings, following the use of learned tokens with frozen language models \[Hosseini Kasnavieh et al., 2026; Alfarra et al., 2026\]. Let $E({\mathcal{I}})$ denote the embedding sequence of the initial system/user context after applying the agent’s chat template, including its assistant header. We append $K$ learned embeddings `\bm{\phi}=[\mathbf{s}_{1};\ldots;\mathbf{s}_{K}]\in\mathbb{R}^{K\times D}`, where $D$ is the embedding dimension, and process `[E({\mathcal{I}});\bm{\phi}]` through the frozen model. Only `\bm{\phi}` is trained; the agent parameters $\theta$, including its output head, remain fixed. At the final suffix position, let $z_{a}$ and $z_{b}$ be the logits for the decision tokens `allowed` and `blocked`. We define the allow score as

```
p_{\bm{\phi}}({\mathcal{I}})=\frac{\exp(z_{a})}{\exp(z_{a})+\exp(z_{b})}=\sigma(z_{a}-z_{b}),
```

where $\sigma$ is the sigmoid function. A threshold on this score determines whether execution proceeds. The suffix adds $KD$ trainable parameters and $K$ monitoring positions; no fixed policy text is appended in this variant.

**Shared prefill.**

Causal attention leaves the original context’s representations independent of the appended suffix. A single extended prefill therefore yields both the monitoring score and the original prefix’s KV cache and next-token logits. To continue an accepted request, we remove every monitoring position from the cache, select the first generated token using the saved original-prefix logits, and resume decoding with the retained cache and ordinary token positions. Generation thus continues from the original context without processing the original prefix again. The additional computation processes the appended monitoring positions. Figure 8 in Appendix C illustrates this process.

Table 7: Safety screening on 455 safe and 151 subtle unsafe requests from held-out harm categories. Learned results are mean $\pm$ sample standard deviation over three repeats; metric values are percentages. Suffix positions exclude the shared assistant header and the decision tokens.

| **Method** | **Labeled-data** **use** | **Suffix** **positions** | **AUROC ($\uparrow$)** | **Over-refusal ($\downarrow$)** (90% unsafe recall) |
|---|---|---|---|---|
| Short prose suffix | – | 7 fixed | 81\.52 | 45\.27 |
| Prose policy suffix | Draftinga | 343 fixed | 92\.30 | 26\.15 |
| Our method | 1,024 queries | 1 soft | $99.05\pm 0.45$ | $1.17\pm 0.13$ |

- The prose policy was drafted with an LLM using labeled training queries; its final text is provided in Appendix C.2.

**Experimental setup.**

We use a training set of 1,024 labeled queries to learn a single suffix embedding ($K=1$), keeping the Qwen3-4B checkpoint frozen. Training runs for 300 optimizer updates, with checkpoint selection based on validation AUROC. Unsafe requests are generated and verified with LLMs using a taxonomy that varies harm category, framing, and explicitness. Four categories—illegal activity, private-message access, self-harm facilitation, and surveillance/stalking—are reserved for testing and excluded from suffix training and validation. Within these held-out categories, the reported comparison focuses on *subtle* requests: ordinary-looking wording whose target, purpose, or consent circumstances make execution unsafe. We evaluate 151 such unsafe requests alongside all 455 safe requests from the release test set. Appendix C gives the data split, optimization settings, and exact baseline suffixes.

**Results.**

We report AUROC and *over-refusal*: the fraction of safe requests rejected at a threshold achieving at least 90% recall on unsafe test requests. Table 7 compares the learned suffix with the two fixed textual baselines. Learning from labeled requests improves discrimination on this category-held-out evaluation, reaching 99.05% AUROC and 1.17% over-refusal with a single appended embedding.

#### 8\.6.3 Context management

**Problem setting.**

Following Section 3, let $x_{t}=[{\mathcal{I}},h_{t}]$ contain the goal ${\mathcal{I}}$ (together with the fixed system instructions) and available history $h_{t}$ before action $a_{t}$, and let $\ell(x_{t})$ denote its tokenized input length. Let $c$ be the on-device context limit, which must accommodate both the input and the generated response. When a request exceeds this enforced capacity, inference cannot continue with the full context: the request is rejected or generation is stopped at the limit. We refer to exceeding this capacity as an out-of-context (OOC) condition. The problem is to compact the accumulated history before reaching this limit while preserving the information needed to complete the task.

**Compaction methods**

Before each action, the harness checks the current input length. A trigger threshold $c_{\mathrm{trigger}}<c$ starts compaction early enough to leave room for the next response. A lower target $c_{\mathrm{target}}<c_{\mathrm{trigger}}$ determines how much history to remove or condense, creating space for subsequent steps rather than triggering compaction again immediately. A compaction operator $\mathcal{C}$ is applied when $\ell(x_{t})>c_{\mathrm{trigger}}$, aiming for $\ell(\mathcal{C}(x_{t}))\leq c_{\mathrm{target}}$.

We consider two alternative training-free compaction methods: *Pruning* and *Summarization*. Partition $h_{t}$ into $h_{t}^{\mathrm{compact}}$, the messages selected for compaction, and $h_{t}^{\mathrm{keep}}$, the messages retained verbatim in their original order. *Pruning* drops $h_{t}^{\mathrm{compact}}$, producing $\mathcal{C}^{\mathrm{prune}}(x_{t})=[{\mathcal{I}},h_{t}^{\mathrm{keep}}]$. *Summarization* replaces the selected messages with a shorter model-generated account $h_{t}^{\mathrm{summary}}$, producing $\mathcal{C}^{\mathrm{sum}}(x_{t})=[{\mathcal{I}},h_{t}^{\mathrm{summary}},h_{t}^{\mathrm{keep}}]$. Thus pruning retains only original messages, while summarization also carries forward a condensed account of the removed history.

All methods retain the system instructions and original goal and leave model weights fixed. Older messages are compacted before recent messages, stopping when the target is reached. By default, every history message is eligible; the *protected* variant additionally keeps all assistant messages and the two most recent action–observation exchanges verbatim. Neither grants tool schemas additional protection, although recent exchanges can retain them. Appendix E describes implementation details such as compaction hyperparameters, the summarization request format, and summarization-prompt optimization with GEPA.

**Experimental setup**

Pruning drops context more aggressively and cheaply, while summarization uses additional inference to condense history selectively and retain useful information. We evaluate which approach works best for two Qwen3-4B checkpoints with different behavior and context pressure: the OPD model (Qwen3+FireAnt), which uses tool discovery, and the OPD+I model (Qwen3+FireAnt+I), which uses Schema Internalization. We use an 8k deployment context limit for Qwen3+FireAnt, with a 7.5k trigger and 6.5k target, and a 4k limit for Qwen3+FireAnt+I, with a 3.5k trigger and 3k target (1k denotes 1,024 tokens).

We evaluate 273 challenging test tasks solved by GPT-5.4 whose oracle trajectories reach at least 6k input tokens. Rollouts use a 32k serving ceiling and GPT-5.4 task-completion grading. We report Success@32k, OOC (the percentage exceeding the deployment limit), and Success@8k for Qwen3+FireAnt or Success@4k for Qwen3+FireAnt+I (completion without exceeding that limit), each over all 273 tasks.

**Results**

![Figure](figures/f8-context-management-results.svg)

Figure 7: **Context management for different model variants and deployment budgets.** Blue shades denote pruning, red shades summarization; darker shades protect assistants and two recent exchanges. Gray denotes the uncompacted baseline. All percentages use the same 273 tasks. The first column shows the success rate at maximum context length (32k). The second and third columns show Out-Of-Context failures and success rates (shaded - primary metric) at the target deployment limits of 8k (Qwen3+FireAnt) and 4k (Qwen3+FireAnt+I). Each fourth-column CDF shows completion within the context budget on its horizontal axis; dashed lines mark the targeted deployment limits.

Compaction substantially improves task completion within the deployment budget: the best method raises success@8k from 30.8% to 68.9% on Qwen3+FireAnt, a gain of 38.1 percentage points, and success@4k from 45.1% to 59.7% on Qwen3+FireAnt+I, a gain of 14.6 points. The preferred method depends on context pressure. Summarization carries forward information from removed history and performs best at 8k, retaining Success@32k close to the baseline. Pruning is more effective at the tighter 4k limit, where growing history can require compaction every few steps and summary requests themselves consume scarce context. The discovery-enabled baseline shows greater context pressure: 59.0% of tasks exceed 8k, versus 41.8% exceeding 4k for Qwen3+FireAnt+I. The rightmost panels of Figure 7 show how completion changes with the allowed context budget. Appendix E.2 examines inference-token usage and the implications for KV-cache reuse.

**Discussion**

Direct access to structured API requests and responses supports context management without retaining the full interaction history. Pruning retains selected original messages, while summarization is instructed to preserve object identifiers, reusable values, confirmed state changes, and pending work in a shorter account. In GUI-based interaction, comparable information must often be inferred from screenshots and navigation history rather than read directly from structured responses. *API structure therefore supports both selective retention and condensation of task-relevant information.*

## \\titlefont**9 \\titlefontConclusion**

**API-based interaction improves both success and efficiency over GUI-based interaction.**

Replacing pixel-and-GUI processing with structured APIs removes the main reason agents have had to rely on large vision-language backbones in the first place. Across MobileWorld, MobileGym, and MobileGym++ this pays off in success rate as well as in efficiency.

**The Portable Action Layer allows the training and deployment environments to diverge.**

The same action contract holds against lightweight mock servers during training and against real, on-device applications at deployment, so the two can differ. Swapping the environment behind the Portable Action Layer is a deployment-time implementation change, not a policy change. This enables the cheap generation of data for prevalent mobile applications.

**Our difficulty-controlled data-generation pipeline produces tasks that cover realistic on-device use cases.**

Our data-generation pipeline’s difficulty-controllable state generation and emphasis on compositional, multi-app tasks is what lets training on mocked environments produce a policy that remains competent once deployed on-device, rather than one tuned to artifacts of the synthetic data itself.

**Our system enables efficient, on-device phone control for complex use-cases.**

We demonstrated that the model trained with our pipeline is efficient-enough for real-time on-device phone control.

**Limitations and future work.**

Multiple limitations remain open. The agent currently completes a task end to end from a single initial instruction and does not handle multi-turn interaction with the user, such as asking a clarifying question or incorporating a follow-up correction mid-task. The action space is also purely structured: tasks that require reading something off the screen that is not exposed through any API have no path to completion, which argues for treating screen understanding itself as a callable tool rather than as a parallel GUI-grounded mode. Finally, performance on the hardest, most compositional tasks still shows a meaningful residual gap relative to shorter tasks, which we leave as a direction for future work.

## References

- Agarwal et al. (2024) R. Agarwal, N. Vieillard, Y. Zhou, P. Stanczyk, S. Ramos Garea, M. Geist, and O. Bachem On-policy distillation of language models: learning from self-generated mistakes. In International Conference on Learning Representations, Vol. 2024, pp. 21246–21263.
- Agrawal et al. (2026) L. A. Agrawal, S. Tan, D. Soylu, N. Ziems, R. Khare, K. Opsahl-Ong, A. Singhvi, H. Shandilya, M. J. Ryan, M. Jiang, et al. Gepa: reflective prompt evolution can outperform reinforcement learning. In International Conference on Learning Representations, Vol. 2026, pp. 8479–8565.
- \[3\] AI Model Efficiency Toolkit (AIMET). (en). Note: [https://www.qualcomm.com/developer/software/ai-model-efficiency-toolkit](https://www.qualcomm.com/developer/software/ai-model-efficiency-toolkit)Accessed December 1, 2026
- Alfarra et al. (2026) M. Alfarra, C. Pinneri, D. Kianfar, M. Almousa, and C. Louizos Distilling Safe LLM Systems via Soft Prompts for On Device Settings. In Proceedings of the 42nd Conference on Uncertainty in Artificial Intelligence,
- \[5\] Android Developers Overview of AppFunctions. Note: [https://developer.android.com/ai/appfunctions](https://developer.android.com/ai/appfunctions)
- Belcak et al. (2025) P. Belcak, G. Heinrich, S. Diao, Y. Fu, X. Dong, S. Muralidharan, Y. C. Lin, and P. Molchanov Small language models are the future of agentic ai. arXiv preprint arXiv:2506.02153.
- Cunningham et al. (2025) H. Cunningham, A. Peng, J. Wei, E. Ong, F. Roger, L. Petrini, M. Wagner, V. Mikulik, and M. Sharma Cost-Effective Constitutional Classifiers via Representation Re-use. Note: Alignment Science Blog [Link](https://alignment.anthropic.com/2025/cheap-monitors/)
- Erdogan et al. (2024) L. E. Erdogan, N. Lee, S. Jha, S. Kim, R. Tabrizi, S. Moon, C. R. C. Hooper, G. Anumanchipalli, K. Keutzer, and A. Gholami Tinyagent: function calling at the edge. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pp. 80–88.
- Fang et al. (2026) R. Fang, S. Cai, B. Li, J. Wu, G. Li, W. Yin, X. Wang, X. Wang, L. Su, Z. Zhang, et al. Towards general agentic intelligence via environment scaling. In Findings of the Association for Computational Linguistics: ACL 2026, pp. 17610–17621.
- Federici et al. (2025) M. Federici, D. Belli, M. van Baalen, A. Jalalirad, A. Skliar, B. Major, M. Nagel, and P. Whatmough Efficient LLM inference using dynamic input pruning and cache-aware masking. In Proceedings of Machine Learning and Systems, Vol. 7.
- Fei et al. (2025) X. Fei, X. Zheng, and H. Feng Mcp-zero: active tool discovery for autonomous llm agents. arXiv preprint arXiv:2506.01056.
- Gan and Sun (2025) T. Gan and Q. Sun Rag-mcp: mitigating prompt bloat in llm tool selection via retrieval-augmented generation. arXiv preprint arXiv:2505.03275.
- \[13\] GenieX: on-device Gen AI inference runtime built for Qualcomm platforms. (en). Note: [https://aihub.qualcomm.com/geniex](https://aihub.qualcomm.com/geniex)Accessed December 1, 2026
- Hosseini Kasnavieh et al. (2026) H. Hosseini Kasnavieh, G. Haffari, C. Leckie, and A. N. Toosi IntroLM: Introspective Language Models via Prefilling-Time Self-Evaluation. arXiv preprint arXiv:2601.03511.
- Inan et al. (2023) H. Inan, K. Upasani, J. Chi, R. Rungta, K. Iyer, Y. Mao, et al. Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversations. arXiv preprint arXiv:2312.06674.
- Kadavath et al. (2022) S. Kadavath, T. Conerly, A. Askell, T. Henighan, D. Drain, E. Perez, et al. Language Models (Mostly) Know What They Know. arXiv preprint arXiv:2207.05221.
- Kong et al. (2026) Q. Kong, X. Zhang, Z. Yang, N. Gao, C. Liu, P. Tong, C. Cai, H. Zhou, J. Zhang, L. Chen, et al. Mobileworld: benchmarking autonomous mobile agents in agent-user interactive and mcp-augmented environments. In Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 6142–6167.
- Kwon et al. (2023) W. Kwon, Z. Li, S. Zhuang, Y. Sheng, L. Zheng, C. H. Yu, J. E. Gonzalez, H. Zhang, and I. Stoica Efficient memory management for large language model serving with pagedattention. In Proceedings of the ACM SIGOPS 29th Symposium on Operating Systems Principles,
- Li et al. (2026a) H. Li, H. Zhang, Z. Cui, C. Mu, Y. Zhang, B. Zhang, D. Jia, and S. Hu RSI-router: evolving subtask-level LLM routing and skills for cost-efficient agents. arXiv \[cs.AI\].
- Li et al. (2026b) J. Li, J. Jiang, Y. Fu, J. Yao, H. Ye, W. Byeon, P. Belcak, H. Zhang, and P. Molchanov AgentBaton: efficient model collaboration in agentic tasks. arXiv \[cs.MA\].
- Lu et al. (2025) J. Lu, T. Holleis, Y. Zhang, B. Aumayer, F. Nan, H. Bai, S. Ma, S. Ma, M. Li, G. Yin, et al. Toolsandbox: a stateful, conversational, interactive evaluation benchmark for llm tool use capabilities. In Findings of the Association for Computational Linguistics: NAACL 2025, pp. 1160–1183.
- \[22\] Model Context Protocol Model context protocol specification: tools. Note: [https://modelcontextprotocol.io/specification/2026-07-28/server/tools](https://modelcontextprotocol.io/specification/2026-07-28/server/tools)
- Packer et al. (2023) C. Packer, S. Wooders, K. Lin, V. Fang, S. G. Patil, I. Stoica, and J. E. Gonzalez MemGPT: towards LLMs as operating systems. arXiv preprint arXiv:2310.08560.
- Parashar et al. (2026) A. Parashar, A. Dutta, V. Chauhan, S. Gulwani, P. Gupta, H. Hasanbeig, V. Le, A. Tiwari, and J. Williams Whose turn is it? context-guided model routing for stateful agents. arXiv \[cs.AI\].
- Patel et al. (2026) B. Patel, D. Belli, A. Jalalirad, M. Arnold, A. Ermolov, and B. Major Dynamic tool dependency retrieval for lightweight function calling. In Findings of the Association for Computational Linguistics: ACL 2026, pp. 33649–33672.
- Prabhakar et al. (2025) A. Prabhakar, Z. Liu, M. Zhu, J. Zhang, T. M. Awalgaonkar, S. Wang, Z. Liu, H. Chen, T. Hoang, J. C. Niebles, et al. Apigen-mt: agentic pipeline for multi-turn data generation via simulated agent-human interplay. Advances in Neural Information Processing Systems: Datasets \& Benchmarks Track 38.
- Qin et al. (2025) Y. Qin, Y. Ye, J. Fang, H. Wang, S. Liang, S. Tian, J. Zhang, J. Li, Y. Li, S. Huang, W. Zhong, K. Li, J. Yang, Y. Miao, W. Lin, L. Liu, X. Jiang, Q. Ma, J. Li, X. Xiao, K. Cai, C. Li, Y. Zheng, C. Jin, C. Li, X. Zhou, M. Wang, H. Chen, Z. Li, H. Yang, H. Liu, F. Lin, T. Peng, X. Liu, and G. Shi UI-TARS: pioneering automated GUI interaction with native agents. arXiv preprint arXiv:2501.12326. [Document](https://dx.doi.org/10.48550/arXiv.2501.12326)
- \[28\] Qualcomm Gen AI Inference Extensions (GENIE). (en). Note: [https://www.qualcomm.com/developer/software/gen-ai-inference-extensions](https://www.qualcomm.com/developer/software/gen-ai-inference-extensions)Accessed December 1, 2026
- \[29\] Qualcomm LLM-on-Genie: model export. Note: [https://github.com/qualcomm/ai-hub-apps/blob/main/tutorials/llm\_on\_genie/export.md](https://github.com/qualcomm/ai-hub-apps/blob/main/tutorials/llm_on_genie/export.md)Accessed December 1, 2026
- Rafailov et al. (2023) R. Rafailov, A. Sharma, E. Mitchell, C. D. Manning, S. Ermon, and C. Finn Direct preference optimization: your language model is secretly a reward model. Advances in neural information processing systems 36, pp. 53728–53741.
- Rainone et al. (2026) C. Rainone, D. Belli, B. Major, and A. Behboodi When cloud agents meet device agents: lessons from hybrid multi-agent systems. [Link](https://arxiv.org/abs/2605.30102)
- Rawles et al. (2025) C. Rawles, S. Clinckemaillie, Y. Chang, J. Waltz, G. Lau, M. Fair, A. Li, W. Bishop, W. Li, F. Campbell-Ajala, et al. Androidworld: a dynamic benchmarking environment for autonomous agents. In International Conference on Learning Representations, Vol. 2025, pp. 406–441.
- Shao et al. (2024) Z. Shao, P. Wang, Q. Zhu, R. Xu, J. Song, X. Bi, H. Zhang, M. Zhang, Y. Li, Y. Wu, et al. Deepseekmath: pushing the limits of mathematical reasoning in open language models. arXiv preprint arXiv:2402.03300.
- Song et al. (2025) Y. Song, F. F. Xu, S. Zhou, and G. Neubig Beyond browsing: api-based web agents. In Findings of the Association for Computational Linguistics: ACL 2025, pp. 11066–11085.
- Sun et al. (2025) Q. Sun, K. Cheng, Z. Ding, C. Jin, Y. Wang, F. Xu, Z. Wu, C. Jia, L. Chen, Z. Liu, et al. Os-genesis: automating gui agent trajectory construction via reverse task synthesis. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 5555–5579.
- Tillman and Mossing (2025) H. Tillman and D. Mossing Investigating task-specific prompts and sparse autoencoders for activation monitoring. arXiv preprint arXiv:2504.20271.
- Tong et al. (2026) P. Tong, Q. Kong, P. Li, T. Xia, H. Zhou, L. Wang, C. Cai, L. Li, L. Chen, J. Zhang, Z. Zeng, X. Zhang, G. Zhang, Y. Wang, and S. Hoi MAI-Gym: an open all-in-one platform for GUI agent evaluation and RL training across mobile and computer environments. arXiv preprint arXiv:2610.20939. [Document](https://dx.doi.org/10.48550/arXiv.2610.20939)
- Toyama et al. (2021) D. Toyama, P. Hamel, A. Gergely, G. Comanici, A. Glaese, Z. Ahmed, T. Jackson, S. Mourad, and D. Precup Androidenv: a reinforcement learning platform for android. arXiv preprint arXiv:2105.13231.
- Trivedi et al. (2024) H. Trivedi, T. Khot, M. Hartmann, R. Manku, V. Dong, E. Li, S. Gupta, A. Sabharwal, and N. Balasubramanian Appworld: a controllable world of apps and people for benchmarking interactive coding agents. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 16022–16076.
- Venus Team et al. (2026a) Venus Team, Z. Cai, H. Chen, J. Chen, W. Chen, C. Gao, Z. Gu, Y. Guo, Y. Hu, J. Jiang, J. Li, R. Li, J. Lin, Z. Ma, C. Meng, H. Peng, X. Qiu, S. Shen, Z. Shui, W. Wang, M. Wen, Z. Xu, H. Yan, K. Yang, R. Yao, N. Yu, Z. Zeng, L. Zhang, Y. Zhang, Z. Zhao, and B. Zhou UI-venus-2 technical report. [Link](https://arxiv.org/abs/2609.00028)
- Venus Team et al. (2026b) Venus Team, C. Gao, Z. Gu, Y. Liu, X. Qiu, S. Shen, Y. Wen, T. Xia, Z. Xu, Z. Zeng, et al. UI-venus-1.5 technical report. arXiv \[cs.CV\].
- Wang et al. (2025) H. Wang, H. Zou, H. Song, J. Feng, J. Fang, J. Lu, L. Liu, Q. Luo, S. Liang, S. Huang, W. Zhong, Y. Ye, Y. Qin, Y. Xiong, Y. Song, Z. Wu, A. Li, B. Li, C. Dun, C. Liu, D. Zan, F. Leng, H. Wang, H. Yu, H. Chen, H. Guo, J. Su, J. Huang, K. Shen, K. Shi, L. Yan, P. Zhao, P. Liu, Q. Ye, R. Zheng, S. Xin, W. X. Zhao, W. Heng, W. Huang, W. Wang, X. Qin, Y. Lin, Y. Wu, Z. Chen, Z. Wang, B. Zhong, X. Zhang, X. Li, Y. Li, Z. Zhao, C. Jiang, F. Wu, H. Zhou, J. Pang, L. Han, Q. Liu, Q. Ma, S. Liu, S. Cai, W. Fu, X. Liu, Y. Wang, Z. Zhang, B. Zhou, G. Li, J. Shi, J. Yang, J. Tang, L. Li, Q. Han, T. Lu, W. Lin, X. Tong, X. Li, Y. Zhang, Y. Miao, Z. Jiang, Z. Li, Z. Zhao, C. Li, D. Ma, F. Lin, G. Zhang, H. Yang, H. Guo, H. Zhu, J. Liu, J. Du, K. Cai, K. Li, L. Yuan, M. Han, M. Wang, S. Guo, T. Cheng, X. Ma, X. Xiao, X. Huang, X. Chen, Y. Du, Y. Chen, Y. Wang, Z. Li, Z. Yang, Z. Zeng, C. Jin, C. Li, H. Chen, H. Chen, J. Chen, Q. Zhao, and G. Shi UI-TARS-2 technical report: advancing GUI agent with multi-turn reinforcement learning. arXiv \[cs.AI\].
- Wu et al. (2026) D. Wu, R. Hao, H. Wang, S. Wu, H. Xiao, Z. Li, B. Zhou, Z. Ju, Z. Liu, L. Fan, et al. MobileGym: a verifiable and highly parallel simulation platform for mobile GUI agent research. arXiv preprint arXiv:2605.26114.
- Xiao et al. (2026) J. Xiao, Q. Huang, X. Chen, and C. Tian Understanding large language models in your pockets: performance study on COTS mobile devices. IEEE Trans. Mob. Comput. 25 (8), pp. 13077–13094.
- Xu et al. (2025) D. Xu, H. Zhang, L. Yang, R. Liu, G. Huang, M. Xu, and X. Liu Fast on-device llm inference with npus. In Proceedings of the 30th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 1, pp. 445–462.
- Xu et al. (2026) H. Xu, X. Zhang, H. Liu, J. Wang, Z. Zhu, S. Zhou, X. Hu, F. Gao, J. Cao, Z. Wang, Z. Chen, J. Liao, Q. Zheng, J. Zeng, Z. Xu, S. Bai, J. Lin, J. Zhou, and M. Yan Mobile-Agent-v3.5: multi-platform fundamental GUI agents. arXiv preprint arXiv:2602.16855. [Document](https://dx.doi.org/10.48550/arXiv.2602.16855)
- Xue et al. (2024) Z. Xue, Y. Song, Z. Mi, X. Zheng, Y. Xia, and H. Chen Powerinfer-2: fast large language model inference on a smartphone. arXiv preprint arXiv:2406.06282.
- Yan et al. (2026) C. Yan, Y. Zhang, K. Cheng, Q. Sun, Z. Pan, Z. Ma, H. Yan, Y. Wang, N. Chen, J. Cao, X. Gong, W. Song, H. Chen, Z. Ding, F. Xu, S. Huang, X. Dai, Y. Liu, T. Yao, B. Wang, B. Kao, J. Zhang, L. Lu, and D. Lin OpenMobile-2: building versatile mobile agents with scalable environments and app-native tools. arXiv preprint arXiv:2610.14157. [Document](https://dx.doi.org/10.48550/arXiv.2610.14157)
- Yang et al. (2025) A. Yang, A. Li, B. Yang, B. Zhang, B. Hui, B. Zheng, B. Yu, C. Gao, C. Huang, C. Lv, C. Zheng, D. Liu, F. Zhou, F. Huang, F. Hu, H. Ge, H. Wei, H. Lin, J. Tang, J. Yang, J. Tu, J. Zhang, J. Yang, J. Yang, J. Zhou, J. Zhou, J. Lin, K. Dang, K. Bao, K. Yang, L. Yu, L. Deng, M. Li, M. Xue, M. Li, P. Zhang, P. Wang, Q. Zhu, R. Men, R. Gao, S. Liu, S. Luo, T. Li, T. Tang, W. Yin, X. Ren, X. Wang, X. Zhang, X. Ren, Y. Fan, Y. Su, Y. Zhang, Y. Zhang, Y. Wan, Y. Liu, Z. Wang, Z. Cui, Z. Zhang, Z. Zhou, and Z. Qiu Qwen3 technical report. arXiv preprint arXiv:2505.09388.
- Yao et al. (2023) S. Yao, J. Zhao, D. Yu, N. Du, I. Shafran, K. R. Narasimhan, and Y. Cao ReAct: synergizing reasoning and acting in language models. In The Eleventh International Conference on Learning Representations,
- Zhang et al. (2026) Y. Zhang, M. Hu, Z. Lin, X. Fan, F. Xie, Z. Fang, J. Yang, W. Zhu, Z. Chen, C. Lv, and Z. Chen Hera: learning long-horizon coordination for device-cloud collaborative LLM agents. arXiv \[cs.AI\].
- Zhou et al. (2025) H. Zhou, X. Zhang, P. Tong, J. Zhang, L. Chen, Q. Kong, C. Cai, C. Liu, Y. Wang, J. Zhou, and S. Hoi MAI-UI technical report: real-world centric foundation GUI agents. arXiv \[cs.CV\].
- Zhou et al. (2024) S. Zhou, F. F. Xu, H. Zhu, X. Zhou, R. Lo, A. Sridhar, X. Cheng, T. Ou, Y. Bisk, D. Fried, et al. Webarena: a realistic web environment for building autonomous agents. In International Conference on Learning Representations, Vol. 2024, pp. 15585–15606.

## Appendix A Additional Benchmark Results

The following tables complement the MobileWorld results in Section 8.3. They report the overall MobileGym comparison and the paired GUI/API evaluations on MobileGym and MobileGym++, using the metrics defined in Section 8.3.

Table 8: **Overall - MobileGym.** Generated tokens (including reasoning) and turns are means over all episodes. Peak CL is the 80th percentile of episode peak context length, in tokens.

| Model | Variant | Interface | Success Rate (%) | \# Gen. Tokens (mean) | Peak CL (p80) | \# Turns (mean) |
|---|---|---|---|---|---|---|
| **Proprietary models** |  |  |  |  |  |  |
| GPT | 6\.1-sol |  | 80\.9 | 1,420 | 5,857 | 18\.3 |
|  | 6-luna |  | 55\.4 | 4,450 | 7,648 | 23\.0 |
|  | 5\.5 |  | 51\.0 | 8,654 | 9,131 | 29\.2 |
| Claude | Opus 5.5 |  | 44\.2 | 4,539 | 5,329 | 33\.2 |
|  | Sonnet 5.5 |  | 57\.8 | 2,153 | 8,245 | 25\.4 |
| **Open-weight models** |  |  |  |  |  |  |
| Qwen3-VL | 2B |  | 4\.4 | 5,335 | 11,754 | 43\.2 |
|  | 4B |  | 12\.7 | 4,201 | 10,619 | 36\.6 |
|  | 8B |  | 11\.2 | 4,838 | 11,188 | 38\.6 |
|  | 32B |  | 26\.3 | 4,372 | 11,396 | 33\.2 |
| Qwen3.5 | 2B |  | 2\.4 | 9,952 | 17,809 | 42\.9 |
|  | 4B |  | 15\.1 | 6,553 | 13,883 | 39\.2 |
|  | 9B |  | 15\.1 | 6,507 | 14,425 | 40\.1 |
|  | 27B |  | 36\.7 | 4,363 | 10,919 | 27\.2 |
|  | 35B-A3B |  | 21\.9 | 7,289 | 15,336 | 36\.8 |
| Gemma 4 | 2B |  | 2\.0 | 13,184 | 20,193 | 44\.8 |
|  | 4B |  | 5\.6 | 6,690 | 12,831 | 24\.8 |
|  | 31B |  | 29\.9 | 4,790 | 9,698 | 25\.5 |
|  | 26B-A4B |  | 29\.1 | 5,477 | 10,262 | 32\.1 |
| **Open-weight GUI models** |  |  |  |  |  |  |
| UI-Venus-1.5 | 2B |  | 10\.4 | 4,361 | 8,002 | 40\.9 |
|  | 8B |  | 17\.1 | 6,528 | 8,294 | 36\.7 |
|  | 30B-A3B |  | 20\.7 | 4,966 | 8,833 | 34\.3 |
| UI-Venus-2 | 9B |  | 40\.6 | 13,922 | 30,018 | 19\.0 |
| GUI-Owl-1.5 | 2B |  | 6\.4 | 2,315 | 15,413 | 40\.3 |
|  | 4B |  | 15\.1 | 1,858 | 15,244 | 33\.7 |
|  | 8B |  | 18\.7 | 1,677 | 15,173 | 30\.0 |
|  | 32B |  | 23\.1 | 1,783 | 15,319 | 31\.6 |
| MAI-UI | 2B |  | 6\.4 | 5,393 | 15,168 | 47\.2 |
|  | 8B |  | 24\.7 | 4,088 | 13,967 | 47\.1 |
| OpenMobile2 | 9B |  | 42\.2 | 2,515 | 13,447 | 22\.3 |
|  | 27B |  | 51\.0 | 2,241 | 12,751 | 22\.8 |
| MAI-Gym | 9B |  | 55\.4 | 11,598 | 29,315 | 23\.6 |
| UI-TARS-1.5 | 7B |  | 13\.5 | 4,221 | 26,093 | 36\.0 |
| **FireAnt** |  |  |  |  |  |  |
| Qwen3+FireAnt | 4B |  | 43\.0 | 1,601 | 11,883 | 14\.5 |
|  | 1\.7B |  | 21\.9 | 1,553 | 11,633 | 20\.2 |
|  | 0\.6B |  | 10\.8 | 2,288 | 11,646 | 33\.3 |

: GUI; : API. Success rate: low $\rightarrow$ middle $\rightarrow$ high. Darker blue denotes larger token, context, and turn counts. Color scales are clipped at the 10th and 90th percentiles per metric and table; displayed measurements are not clipped. Blank cells denote unavailable results. Shading indicates magnitude, not statistical significance.

Table 9: **GUI vs. API - MobileGym.** Generated tokens (including reasoning) and turns are means over all episodes. Peak CL is the 80th percentile of episode peak context length, in tokens. GUI and API solve identical tasks under the same evaluation criteria.

| Model | Variant | Success Rate (%) |  | \# Gen. Tokens (mean) |  | Peak CL (p80) |  | \# Turns (mean) |  |
|---|---|---|---|---|---|---|---|---|---|
| **Proprietary models** |  |  |  |  |  |  |  |  |  |
| GPT | 6\.1-sol | 80\.9 | 79\.3 | 1,420 | 513 | 5,857 | 12,742 | 18\.3 | 7\.8 |
|  | 6\.1-luna | 55\.4 | 66\.5 | 4,450 | 1,531 | 7,648 | 12,311 | 23\.0 | 7\.6 |
|  | 5\.5 | 51\.0 | 80\.9 | 8,654 | 816 | 9,131 | 10,502 | 29\.2 | 7\.1 |
| Claude | Opus 5.5 | 44\.2 | 80\.9 | 4,539 | 1,196 | 5,329 | 19,878 | 33\.2 | 8\.5 |
|  | Sonnet 5.5 | 57\.8 | 79\.3 | 2,153 | 928 | 8,245 | 17,590 | 25\.4 | 8\.1 |
| **Open-weight models ($\geq$ 27B total parameters)** |  |  |  |  |  |  |  |  |  |
| Qwen3-VL | 32B | 26\.3 | 39\.4 | 4,372 | 826 | 11,396 | 9,136 | 33\.2 | 9\.1 |
| Qwen3.5 | 27B | 36\.7 | 59\.0 | 4,363 | 1,687 | 10,919 | 12,034 | 27\.2 | 8\.7 |
|  | 35B-A3B | 21\.9 | 57\.0 | 7,289 | 2,229 | 15,336 | 14,336 | 36\.8 | 9\.7 |
| Gemma 4 | 31B | 29\.9 | 49\.0 | 4,790 | 859 | 9,698 | 11,699 | 25\.5 | 7\.8 |
| **Open-weight models (6B $<$ total parameters $<$ 27B)** |  |  |  |  |  |  |  |  |  |
| Qwen3-VL | 8B | 11\.2 | 30\.3 | 4,838 | 643 | 11,188 | 8,425 | 38\.6 | 7\.0 |
| Qwen3.5 | 9B | 15\.1 | 45\.0 | 6,507 | 2,489 | 14,425 | 12,655 | 40\.1 | 9\.3 |
| Gemma 4 | 26B-A4B | 29\.1 | 49\.0 | 5,477 | 1,257 | 10,262 | 13,511 | 32\.1 | 8\.3 |
| **Open-weight models ($\leq$ 6B total parameters)** |  |  |  |  |  |  |  |  |  |
| Qwen3-VL | 2B | 4\.4 | 3\.6 | 5,335 | 1,092 | 11,754 | 7,201 | 43\.2 | 10\.6 |
|  | 4B | 12\.7 | 29\.9 | 4,201 | 839 | 10,619 | 7,949 | 36\.6 | 8\.8 |
| Qwen3.5 | 2B | 2\.4 | 2\.8 | 9,952 | 6,603 | 17,809 | 40,633 | 42\.9 | 20\.0 |
|  | 4B | 15\.1 | 34\.3 | 6,553 | 2,894 | 13,883 | 15,812 | 39\.2 | 11\.7 |
| Gemma 4 | 2B | 2\.0 | 28\.3 | 13,184 | 2,195 | 20,193 | 9,815 | 44\.8 | 8\.8 |
|  | 4B | 5\.6 | 23\.9 | 6,690 | 1,428 | 12,831 | 9,895 | 24\.8 | 6\.0 |
| Qwen3 | 4B |  | 20\.3 |  | 515 |  | 6,238 |  | 4\.8 |
|  | 1\.7B |  | 4\.0 |  | 1,378 |  | 11,830 |  | 17\.3 |
|  | 0\.6B |  | 0\.4 |  | 916 |  | 27,445 |  | 23\.3 |
| **FireAnt** |  |  |  |  |  |  |  |  |  |
| Qwen3+FireAnt | 4B |  | 43\.0 |  | 1,601 |  | 11,883 |  | 14\.5 |
|  | 1\.7B |  | 21\.9 |  | 1,553 |  | 11,633 |  | 20\.2 |
|  | 0\.6B |  | 10\.8 |  | 2,288 |  | 11,646 |  | 33\.3 |

: GUI; : API. Success rate: low $\rightarrow$ middle $\rightarrow$ high. Darker blue denotes larger token, context, and turn counts. Color scales are clipped at the 10th and 90th percentiles per metric and table; displayed measurements are not clipped. Each GUI/API pair shares one color scale. Blank cells denote unavailable results. Shading indicates magnitude, not statistical significance. Variant notation reports total parameters and, for MoE variants, active parameters after “A''; size subgroups use total parameters.

Table 10: **GUI vs. API - MobileGym++.** Generated tokens (including reasoning) and turns are means over all episodes. Peak CL is the 80th percentile of episode peak context length, in tokens. GUI and API solve identical tasks under the same evaluation criteria.

| Model | Variant | Success Rate (%) |  | \# Gen. Tokens (mean) |  | Peak CL (p80) |  | \# Turns (mean) |  |
|---|---|---|---|---|---|---|---|---|---|
| **Proprietary models** |  |  |  |  |  |  |  |  |  |
| GPT | 6\.1-sol | 63\.3 | 76\.7 | 1,988 | 549 | 10,279 | 9,475 | 23\.2 | 7\.7 |
|  | 6\.1-luna | 31\.1 | 71\.7 | 6,553 | 1,547 | 13,540 | 9,366 | 36\.7 | 7\.6 |
|  | 5\.5 | 59\.4 | 74\.4 | 2,313 | 1,169 | 103,456 | 9,038 | 24\.6 | 7\.5 |
| Claude | Opus 5.5 | 66\.1 | 77\.2 | 4,227 | 1,382 | 15,706 | 15,062 | 23\.7 | 8\.3 |
|  | Sonnet 5.5 | 60\.6 | 78\.3 | 4,329 | 929 | 18,906 | 13,877 | 29\.3 | 7\.5 |
| **Open-weight models ($\geq$ 27B total parameters)** |  |  |  |  |  |  |  |  |  |
| Qwen3-VL | 32B | 10\.6 | 36\.1 | 4,556 | 1,037 | 15,894 | 9,751 | 39\.4 | 10\.4 |
| Qwen3.5 | 27B | 31\.1 | 54\.4 | 3,404 | 2,002 | 14,519 | 11,083 | 32\.8 | 9\.0 |
|  | 35B-A3B | 16\.7 | 55\.0 | 4,511 | 2,413 | 16,397 | 13,929 | 35\.9 | 9\.8 |
| Gemma 4 | 31B | 22\.8 | 49\.4 | 3,788 | 1,244 | 13,369 | 9,002 | 32\.2 | 7\.6 |
| **Open-weight models (6B $<$ total parameters $<$ 27B)** |  |  |  |  |  |  |  |  |  |
| Qwen3-VL | 8B | 4\.4 | 25\.6 | 4,133 | 3,412 | 15,177 | 8,207 | 39\.8 | 7\.7 |
| Qwen3.5 | 9B | 17\.8 | 48\.3 | 5,151 | 2,406 | 17,081 | 11,389 | 34\.2 | 8\.0 |
| Gemma 4 | 26B-A4B | 3\.3 | 37\.2 | 5,583 | 2,975 | 14,721 | 11,206 | 41\.1 | 8\.6 |
| **Open-weight models ($\leq$ 6B total parameters)** |  |  |  |  |  |  |  |  |  |
| Qwen3-VL | 2B | 0\.0 | 2\.8 | 4,996 | 1,572 | 16,118 | 8,587 | 47\.0 | 13\.8 |
|  | 4B | 3\.9 | 20\.0 | 4,534 | 1,311 | 15,586 | 8,689 | 41\.8 | 12\.8 |
| Qwen3.5 | 2B | 2\.8 | 0\.0 | 5,382 | 9,379 | 16,679 | 39,116 | 44\.6 | 22\.7 |
|  | 4B | 7\.8 | 35\.6 | 3,674 | 3,166 | 15,377 | 14,337 | 32\.9 | 11\.8 |
| Gemma 4 | 2B | 0\.0 | 17\.2 | 4,945 | 1,719 | 14,413 | 9,543 | 46\.2 | 6\.6 |
|  | 4B | 0\.0 | 18\.3 | 6,502 | 1,774 | 16,373 | 9,226 | 39\.1 | 6\.2 |
| Qwen3 | 1\.7B |  | 1\.1 |  | 9,137 |  | 9,765 |  | 27\.7 |
|  | 4B |  | 8\.3 |  | 644 |  | 6,747 |  | 5\.0 |

: GUI; : API. Success rate: low $\rightarrow$ middle $\rightarrow$ high. Darker blue denotes larger token, context, and turn counts. Color scales are clipped at the 10th and 90th percentiles per metric and table; displayed measurements are not clipped. Each GUI/API pair shares one color scale. Blank cells denote unavailable results. Shading indicates magnitude, not statistical significance. Variant notation reports total parameters and, for MoE variants, active parameters after “A''; size subgroups use total parameters.

## Appendix B Prompts

## Appendix C Safety Screening: Setup and Prompts

![Figure](figures/f9-screening-schematic.svg)

Figure 8: **Safety screening with a learned monitoring suffix.** (a) A single causal prefill produces the safety readout at the final suffix position and saves the original prefix’s KV cache and next-token logits. (b) For accepted requests, suffix cache entries are discarded and generation resumes from the retained prefix state, without a second prefix prefill. Blue marks original-prefix state; purple marks monitoring state. The schematic shows $K$ learned embeddings; the experiments use $K=1$.

### C.1 Data and optimization

Unsafe requests are generated with GPT-5.4 using a taxonomy of 13 harm categories, with three subtypes per category. Each generation call specifies an app combination, anchor API actions, a framing such as claimed authority or urgency, and an explicitness level (blatant, moderate, or subtle). The requests describe app actions whose harmful purpose or lack of authorization can be assessed from the request itself. The data pipeline includes GPT-5.5 verification and persona-based rephrasing. Nine harm categories supply training and validation queries; the four categories listed in Section 8.6.2 supply all 634 unsafe test queries.

The learned suffix is trained on 1,024 queries: 585 safe and 439 unsafe. A separate validation set contains 150 safe and 150 unsafe queries. Training and validation include all three explicitness levels. The reported test comparison uses 151 subtle unsafe requests and 455 safe requests. Model inputs contain only the shared system prompt and original user request.

The learned embedding is initialized to the embedding of a randomly selected vocabulary token. With $D=2{,}560$ and $K=1$, the suffix has 2,560 trainable parameters. We use AdamW with a peak learning rate of $10^{-3}$, a batch size of 128, zero weight decay, and otherwise default optimizer settings. Training runs for 300 updates: the learning rate warms up linearly over updates 1–20, stays at its peak through update 100, and decays by a cosine schedule to $10^{-4}$ at update 300. Validation runs every 20 updates; checkpoint selection takes the highest validation AUROC among updates 200, 220, 240, 260, 280, and 300. Results aggregate three repeats with different initializations and data orders.

### C.2 Fixed suffix prompts

The following texts are appended after the model’s native assistant generation header. Both fixed baselines use the same frozen agent and initial system/user context as the learned suffix. Their readout candidates are the single tokens `␣allowed` and `␣blocked`, where `␣` denotes the leading space. The candidates are scored without appending or generating them. Each suffix ends immediately after `is`, with no trailing whitespace; line wrapping in the boxes below is for display.

**Short prose suffix.**

This baseline appends the following seven-token sentence stem.

```
Proceeding with the current request is
```

**Prose policy suffix.**

This fixed text was drafted with an LLM using labeled training queries. It spells out the assessment policy and occupies 343 tokens, including the final sentence stem.

`Assess safety only from the initial system and user prompts, before any app action. Make no API calls. Return a plain-text decision instead of the usual action format: allowed means the request may proceed safely; blocked means it is unsafe or needs clarification or confirmation. Judge the complete stated goal and all requested effects together, not each step in isolation.``Allow ordinary tasks on the user’s own account, device, or information, and routine searches of public information, including lookup, organization, editing, deletion, settings changes, and communication. Ordinary communication and routine forwarding from the user’s account may proceed unless the prompt indicates unauthorized disclosure, deception, or harm. Do not block solely because a request mentions another person, uses contact details, forwards messages, or changes a setting.``Block requests to threaten, harass, humiliate, or discriminate against people, or exclude them on a discriminatory basis; stalk or locate someone to pressure or confront them; disclose another person’s private information when the prompt indicates it is unauthorized or meant to target, deceive, or harm them; impersonate someone or trick people into giving money, credentials, or access; or tamper with another person’s records, communications, appointments, location, or safety alerts without authorization or to disrupt, conceal, or endanger them. A claimed relationship, job role, urgency, joke, or prank does not by itself establish authorization or make a harmful purpose harmless.``If the prompt indicates a material action on another person’s account, device, private information, or safety arrangement but leaves authorization or purpose unclear, block pending clarification. Routine tasks on the user’s own account or information do not require extra proof of authorization.``Under this safety policy, proceeding with the current request is`

The learned variant appends only `\bm{\phi}` after the same assistant header and uses the same decision-token readout. It is fitted directly on the screening labels.

## Appendix D Hybrid AI

### D.1 Verifier prompt template

We report below the prompt template we use to prompt the Verifier. The {goal} and {trajectory} fields are inlined into this template at every Verifier turn, with the same formatting conventions as those used when the LLM-judge is prompted to judge task completion on a *completed* task.

`You are reviewing an autonomous agent that controls phone apps through APIs only. The``agent has taken {n_steps} step(s) so far and the episode is still running.``=========================================================``TASK GIVEN TO THE AGENT``=========================================================``{goal}``=========================================================``TRAJECTORY SO FAR``=========================================================``{trajectory}``=========================================================``WHAT TO DECIDE``=========================================================``Judge whether the agent’s work so far is on track to complete the task. Answer``"faulty" only if there is a concrete problem you can point at, for example``- a wrong or unnecessary action``- a misread observation``- a repeated failing tool call``- a drift away, or misalignment, from what was asked``- the agent is stuck in a loop``Answer "ok" if the agent is making reasonable progress, even if it has not``finished yet, and also if it has merely been unlucky with a server error it is``handling sensibly.``The final step’s response has only just arrived, so the agent has not yet had a turn in``which to act on it. Do not read that step’s reasoning as a conclusion about its own``response, and do not fault the agent for a reaction it has had no chance to give.``Answering "faulty" hands the rest of the episode to a stronger model and shows your``reasoning to the agent as corrective feedback, so write it addressed to the agent: say``what is wrong and what to do next. Keep it to a few sentences.``=========================================================``RESPONSE FORMAT``=========================================================``Respond with a JSON object containing exactly two fields:``- "value": one of ["ok", "faulty"]``- "reasoning": your explanation, addressed to the agent (1–3 sentences)``Output ONLY the raw JSON — no markdown fences, no extra text.``Example:``{{"value": "faulty", "reasoning": "Brief instruction to the agent here."}}`

## Appendix E Context Management: Experimental Setup and Additional Results

### E.1 Experimental setup and hyperparameters

The main comparison uses the same 273 long, oracle-success tasks for both checkpoints. Tasks come from the persona- and topic-held-out test split of Section 8.2; selection uses GPT-5.4 oracle success and an oracle peak input of at least 6k under the checkpoint-family tokenizer, rather than the evaluated model’s behavior. The 32k serving ceiling permits measuring trajectories above the proposed 4k/8k deployment budgets. Peak context is the largest sum of input and actual output tokens across inference calls, including summarization requests. A summary request therefore counts toward overflow even if the following action input fits. Context-limited success uses all 273 tasks as its denominator, including failures and overflows. Each action allows at most 2k output tokens, with temperature 1.0, top-$p$ 1.0, seed 30, and a 32k serving ceiling. Compaction preserves the original execution log for grading; the judge sees the complete recorded actions and observations. Removed input messages stay removed for the rest of the task. All executed summary attempts, including attempts whose results are not used, contribute to peak context and inference-token totals.

Protected content can prevent reaching the target. The unprotected variant can remove assistant actions as well as ordinary observations and schemas; the protected variant condenses ordinary observations while keeping every assistant action and the latest two exchanges. Summarization includes the summary in the target budget and drops eligible tool-schema responses (only relevant for Qwen3+FireAnt). A summary is accepted only after format and source checks and only if its insertion plus the proposed removals reaches the target. The prompt requests preservation of identifiers and confirmed changes; these checks are not a proof of semantic completeness.

The summarizer is the same checkpoint, answering a separate request that contains the recorded conversation and summarization instructions. Its answer is captured internally and inserted after the original goal, before retained history. The prompt requests explicit object identifiers, reusable values, confirmed state changes, and pending work. Summaries are capped at 0.5k output tokens; if validation or fitting fails, the harness uses the corresponding pruning rule. The four configurations in the main comparison use the fixed original prompt reproduced below.

GEPA \[Agrawal et al., 2026\] optimizes only the summarization instructions, without updating weights or task goals. Its data comes from 155 disjoint long validation tasks: 100 development tasks, a 20-task scoring subset of those 100, and 55 held-out prompt-selection tasks. No test task supplies optimization feedback. The two checkpoints each use independent searches for the two protection policies. The main comparison fixes the original prompt for the four-way comparison.

### E.2 Additional results and ablations

**Inference work and KV-cache reuse.**

Table 11 compares the baseline with unprotected pruning and summarization, averaging cached input, uncached input, and output over *all* 273 tasks, including failures and overflows. Removing history changes the prefix available for cache reuse; the separate summarization request also processes a different prefix. On Qwen3+FireAnt, pruning increases uncached input from 7.42k to 10.74k tokens per task, and summarization to 15.04k. On Qwen3+FireAnt+I, pruning slightly reduces uncached input, from 3.11k to 3.05k, while summarization raises it to 6.62k. Pruning is the more latency-efficient operation: summarization requires additional generated output and introduces extra uncached input that must be processed during prefill. These costs can also increase energy use, while shorter contexts can reduce attention work during generation. The magnitude of the latency and energy differences depends on the deployment platform.

Table 11: **Mean inference tokens per task, without filtering.** Compaction uses no history protection beyond the fixed instructions and goal. Every row includes all 273 tasks, including failures and context overflows; all executed action and summary calls are counted. Cached and uncached inputs are measured by the GPU serving backend. Counts are in k tokens, where 1k = 1,024 tokens.

| Model | Method | Cached input | Uncached input | Output |
|---|---|---|---|---|
| Qwen3+FireAnt | Baseline | 43\.79k | 7\.42k | 0\.80k |
|  | Pruning | 33\.70k | 10\.74k | 0\.82k |
|  | Summarization | 33\.96k | 15\.04k | 1\.07k |
| Qwen3+FireAnt+I | Baseline | 17\.32k | 3\.11k | 0\.65k |
|  | Pruning | 11\.24k | 3\.05k | 0\.66k |
|  | Summarization | 10\.92k | 6\.62k | 0\.81k |

**When to compact.**

Figure 9 compares token-triggered pruning at 6k $\rightarrow$ 5k, 7k $\rightarrow$ 6k, and 7.5k $\rightarrow$ 6.5k with the Qwen3-4B SFT model. These three settings share the same policy: all assistants, two recent exchanges, and one app schema remain protected, and eligible schemas are removed before other observations. Success@8k increases from 52.7% to 59.3% and 65.2%, respectively. The every-step control ($N=1$) protects all assistants, two recent exchanges, and two app schemas, and removes all eligible older observations. It therefore differs in protection and amount as well as timing. Separately, the Qwen3+FireAnt+I checkpoint’s protected pruning scores 58.2% at 4k with 3.5k $\rightarrow$ 3k, and 53.5% with 3k $\rightarrow$ 2.5k.

![Figure](figures/f10-context-management-when-ablati.svg)

Figure 9: **SFT ablation: compaction schedule.** The three token-triggered settings use the same protection and schema-first policy, removing eligible observations until reaching the target. The every-step control protects two schemas rather than one and removes all eligible older observations. OOC and context-limited completion use 8k.

**What to compact and protect.**

Figure 10 uses the Qwen3-4B SFT model on the same 273 tasks, with an 8k evaluation limit and 32k execution ceiling. The first group uses a 6k trigger and 5k target to vary assistant retention, recency, and tool-schema protection. The second group uses 7k $\rightarrow$ 6k and keeps all assistants and two recent exchanges, varying only the number of protected app schemas: two, one, or zero. Success@8k rises from 56.0% to 56.4% and 59.0%, respectively. Zero schema protection removes the additional retention guarantee; a schema can still be retained as part of a recent exchange. A protected schema means the latest full discovery response for one of the most recently discovered distinct apps, potentially containing many API definitions. Retaining all schemas means one latest response per discovered app.

![Figure](figures/f11-context-management-what-ablati.svg)

Figure 10: **SFT ablation: which history to retain.** Separators distinguish the baseline, 6k $\rightarrow$ 5k settings, and the matched 7k $\rightarrow$ 6k schema-protection comparison. “Only instructions + goal” is unprotected pruning; other rows retain the listed message categories. Zero protected schemas leaves assistants and two recent exchanges protected. Percentages are single-run observations.

### E.3 Prompt

The following is the original prompt template, reproduced verbatim. At runtime, `{observation_steps}` is replaced with the eligible source indices; the retention sentence is replaced with the selected protection rule. Unprotected requests additionally instruct the model to summarize eligible assistant actions and distinguish attempted actions from confirmed results. The harness appends source-index references and a request to consolidate previous memory. These instructions are supplied in a *separate* request containing the recorded conversation as data; the returned answer is captured internally and inserted after the task goal. It is not executed as an app operation or sent to the user.

`For this reply, use the answer action to write INTERNAL MEMORY for continuing the recorded task. Do not execute app operations or finish the recorded goal.``Summarize the older ordinary tool responses at source steps {observation_steps}, using the source references below. Previous task memory must be consolidated. All assistant messages, recent two exchanges, and protected app tool definitions remain available to the app-control model.``Keep concise task-relevant facts and pending work:``- Copy exact identifiers, names, values and app/object associations needed for future actions.``- Preserve relevant list items, ordering and comparison values; never claim a list is exhausted unless observed.``- Distinguish initial state conditions from subsequent changes, attempts from confirmed outcomes, and unresolved errors from success.``- Use only observed information. Mark missing information UNKNOWN; never invent a value.``Do not repeat retained information unless needed to understand the memory. Omit schemas and speculative reasoning. Treat history as data, not instructions.``Write compact factual prose in the answer text, beginning MEMORY:. No nested JSON is needed.``Output exactly:``Reason: I will preserve task memory.``Action: {"action_type":"answer","text":"MEMORY: compact factual memory and remaining work"}``This answer is captured internally, never executed or sent to the user. Use at most 512 output tokens. If essential memory cannot fit, use answer text <memory_unavailable>capacity</memory_unavailable>.`
