experimentalmachines/MobileAgent-RL
Viewer • Updated • 2k • 74
How to use experimentalmachines/LFM3-VL-2B-MobileAgent-Dev-GRPO with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-text-to-text", model="experimentalmachines/LFM3-VL-2B-MobileAgent-Dev-GRPO", trust_remote_code=True)
messages = [
{
"role": "user",
"content": [
{"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
{"type": "text", "text": "What animal is on the candy?"}
]
},
]
pipe(text=messages) # pip install -U transformers accelerate
# Load model directly
from transformers import AutoProcessor, AutoModelForMultimodalLM
processor = AutoProcessor.from_pretrained("experimentalmachines/LFM3-VL-2B-MobileAgent-Dev-GRPO", trust_remote_code=True)
model = AutoModelForMultimodalLM.from_pretrained("experimentalmachines/LFM3-VL-2B-MobileAgent-Dev-GRPO", trust_remote_code=True, device_map="auto")
messages = [
{
"role": "user",
"content": [
{"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
{"type": "text", "text": "What animal is on the candy?"}
]
},
]
inputs = processor.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use experimentalmachines/LFM3-VL-2B-MobileAgent-Dev-GRPO with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "experimentalmachines/LFM3-VL-2B-MobileAgent-Dev-GRPO"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "experimentalmachines/LFM3-VL-2B-MobileAgent-Dev-GRPO",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Describe this image in one sentence."
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
}
}
]
}
]
}'docker model run hf.co/experimentalmachines/LFM3-VL-2B-MobileAgent-Dev-GRPO
How to use experimentalmachines/LFM3-VL-2B-MobileAgent-Dev-GRPO with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "experimentalmachines/LFM3-VL-2B-MobileAgent-Dev-GRPO" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "experimentalmachines/LFM3-VL-2B-MobileAgent-Dev-GRPO",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Describe this image in one sentence."
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
}
}
]
}
]
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "experimentalmachines/LFM3-VL-2B-MobileAgent-Dev-GRPO" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "experimentalmachines/LFM3-VL-2B-MobileAgent-Dev-GRPO",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Describe this image in one sentence."
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
}
}
]
}
]
}'How to use experimentalmachines/LFM3-VL-2B-MobileAgent-Dev-GRPO with Docker Model Runner:
docker model run hf.co/experimentalmachines/LFM3-VL-2B-MobileAgent-Dev-GRPO
LFM3-VL-2B-MobileAgent-Dev-GRPO (formerly LFM3-VL-2B-MobileAgent-v4-RL; see the naming guide)LFM3-VL-2B-MobileAgent insteadLFM3-VL-2B-MobileAgentLFM3-VL-2B-MobileAgentMain plus 200 steps of GRPO reinforcement learning on static screenshots. Not promoted.
| Start | LFM3-VL-2B-MobileAgent |
| Method | GRPO (TRL) on static screenshots, 4 samples per state, KL β 0.001, LoRA rank 16, lr 1e-5; merged |
| Training | 200 steps, 0.95 h on one A100; mean reward over the first / last 20 steps 0.714 → 0.765 |
| Data | MobileAgent-RL @ 9ba36d90: 2,000 states (700 answer, 500 complete, 300 other, 500 click) |
| Phone format | 4-bit GGUF: LFM3-VL-2B-MobileAgent-Dev-GRPO-GGUF |
| Status | Not promoted: failed the promotion rule fixed before training ended; not run on AndroidWorld |
| Check | Rule | Main | GRPO | Result |
|---|---|---|---|---|
| Strict answer match, 136 held-out questions | ≥ Main + 0.05 | 0.868 | 0.890 | fail |
| AndroidControl test, high-level step accuracy | ≥ Main − 0.02 | 0.728 | 0.667 | fail |
| False answers on 80 action-goal controls | ≤ 0.03 | 0.00 | 0.00 | pass |
v4rl_local_export_manifest.json.| Part | Format |
|---|---|
| Image | One screenshot per step, resized to at most 880 × 880 px of area (about 720 image tokens) |
| User text | Goal: … / Installed apps: … / Previous steps: (last 8 steps as n. <intent> -> <action JSON>, or None) / What is the next action? |
| Output | <think>short intent</think> followed by one compact JSON action; coordinates are integers on a 0–1000 grid |
| Decoding | Thinking on, temperature 0 |
You are a phone-use agent operating an Android phone to complete the user's goal.
Each turn you see the goal, the installed apps, your previous steps, and the current screenshot. Reply with ONE next action as JSON.
Coordinates are integers normalized to 0-1000 (x from left, y from top) of the screenshot.
Actions:
{"action_type":"click","point_2d":[x,y]}
{"action_type":"long_press","point_2d":[x,y]}
{"action_type":"input_text","text":"..."} (types into the focused field)
{"action_type":"scroll","direction":"up|down|left|right"} (down = reveal content below)
{"action_type":"open_app","app_name":"..."} (app_name must be one of the installed apps)
{"action_type":"navigate_back"}
{"action_type":"navigate_home"}
{"action_type":"keyboard_enter"}
{"action_type":"wait"}
{"action_type":"answer","text":"..."} (if the goal asks a question: the final reply, as short as possible and in the requested format; ends the task)
{"action_type":"status","goal_status":"complete|infeasible"} (finish a goal that asks for no information; never use it instead of answering a question)
Code, data builders, benchmark harnesses and every result with its source: experimentalmachines/lfm3-mobile-agent (see models and results).
LFM Open License v1.0, inherited from LiquidAI/LFM3-VL-2B (LICENSE).