# Phone actions: requests to function calls

Source: https://docs.surogate.ai/engine/examples/kits/phone/

Qwen3.5-0.8B learns to turn a phone request ("turn on the flashlight and show me the
library on the map") into the exact function calls a phone would run. 20 GRPO steps on
one GPU take exact match on the 961 held-out requests from **74.2% to 85.3%**.

| Steps | Time on one L40S | Before | After | Held-out set | Adapter |
|---|---|---|---|---|---|
| 20 | 60 min | 74.2% | **85.3%** | 961 requests | [Hub ↗](https://huggingface.co/cetusian/qwen3.5-0.8b-mobile-actions-grpo) |

## The task

[google/mobile-actions](https://huggingface.co/datasets/google/mobile-actions)
(CC-BY-4.0): 8,693 training and 961 evaluation requests over seven tools (flashlight,
Wi-Fi settings, calendar event, map, email, contact, and so on). The model sees the tools
and the request and answers with tool calls.

**Reward:** 1 when the ordered list of function names and the ordered list of
arguments both equal the gold answer, else 0. This is the exact-match rule from
Google's own notebook for this dataset. A half-right answer scores nothing.

## Can the base model do it?

Mostly. 74.2% of the time it picks the right tool and gets every argument right. It
fails on the second half of two-part requests, and on arguments it shortens or shifts.

## Run it

```bash
CUDA_VISIBLE_DEVICES=0 surogate grpo-colocate \
  --train examples/kits/phone/train.yaml \
  --infer examples/kits/phone/infer.yaml \
  --orch  examples/kits/phone/orch.yaml
```

32 requests × 8 rollouts a step, answers up to 256 tokens, thinking off, LoRA rank 16.
About 60 minutes to step 20 on one L40S. The run evaluates before step 0 and at step 20.

## Measure again

| | Held-out exact match (961 requests) |
|---|---|
| Base Qwen3.5-0.8B | 74.2% |
| **After 20 steps** | **85.3%** |
| After 40 steps (a longer run) | 83.8% |

Greedy decoding, the same prompt and budget as training, one run. Training on to step
40 did not help, so keep step 20.

We checked the result outside the engine too. On the first 48 held-out requests,
plain `transformers` + `peft` scores the base model 72.9% and the step-20 adapter
89.6%: it fixed 8 answers and broke none.

## What changed

The base model often does only the first of two requested actions:

> **Request:** Turn on the flashlight and show me the location of the Sunnyvale Library on the map.
>
> **Before:** `turn_on_flashlight()`
>
> **After:** `turn_on_flashlight()`, `show_map(query="Sunnyvale Library")`

> **Request:** Please turn off the flashlight and immediately schedule a calendar event titled 'Call Ana about the proposal' for tomorrow at 3:30 PM.
>
> **Before:** `turn_off_flashlight()`
>
> **After:** `turn_off_flashlight()`, `create_calendar_event(title="Call Ana about the proposal", datetime="2025-12-13T15:30:00")`

And it drops detail the user gave:

> **Request:** Can you show me where The Wandering Page bookstore is located in Brooklyn?
>
> **Before:** `show_map(query="The Wandering Page bookstore")`
>
> **After:** `show_map(query="The Wandering Page bookstore in Brooklyn")`

## Use the adapter

```python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

tok = AutoTokenizer.from_pretrained("Qwen/Qwen3.5-0.8B")
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.5-0.8B", torch_dtype="bfloat16")
model = PeftModel.from_pretrained(base, "cetusian/qwen3.5-0.8b-mobile-actions-grpo")
```

Pass the same seven tools with `tools=` in `apply_chat_template` and
`enable_thinking=False`. With Surogate: `surogate serve Qwen/Qwen3.5-0.8B` with the
adapter loaded at runtime ([runtime adapters](/engine/inference/serving-models/)).

## Limits

- Seven tools, the ones in the dataset. A new tool needs new training rows.
- Dates are relative to the date in the dataset's system prompt, as in the data.
- Exact match is strict: an argument with an extra word counts as wrong.
- One run, one seed. Expect a point or two of variance between runs.

Next: compare the other [GRPO kits](/engine/examples/kits/), or read [RL Environments](/engine/guides/rl-environments/) to build a reward of your own.
