Downloads · 30 days
14
20% of all-time downloads
medelharchaoui/gemma4-12b-browser-agent-run14
gemma4-12b-browser-agent-run14 is a image-text-to-text model from medelharchaoui. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as gemma.
A LoRA adapter fine-tuned on top of Google's QAT Gemma 4 12B for web navigation action prediction. Given a screenshot of a browser and a natural-language task, the model predicts the next action to take (click, type,…
Downloads · 30 days
14
20% of all-time downloads
All-time downloads
71
Public
Repo size
14.6 GB
Likes
0
Public
Click a slice to open those files.
.pt10.2 GB · 70%
From the Hugging Face model README
A LoRA adapter fine-tuned on top of Google's QAT Gemma 4 12B for web navigation action prediction. Given a screenshot of a browser and a natural-language task, the model predicts the next action to take (click, type, scroll, navigate, etc.) with chain-of-thought reasoning.
| Base model | google/gemma-4-12B-it-qat-q4_0-unquantized |
| Adapter type | LoRA (DoRA + rsLoRA) |
| Rank / Alpha | r=16, α=16 |
| Target modules | all-linear |
| Saved modules | lm_head, embed_tokens |
| Training steps | 2 400 |
| Effective batch size | 4 (per_device=2 × grad_accum=2) |
| Optimizer | paged_adamw_8bit |
| Precision | bf16 |
| Hardware | 1× A100-80GB (Modal) |
Fine-tuned on allenai/MolmoWeb-HumanTrajs — indices 0–1999 (~2 000 trajectories, ~34 K steps). Indices 2000–2019 were held out for evaluation (never seen during training).
Each training step: screenshot → action prediction with teacher-forced prior-action history (last 10 steps).
mouse_click(x, y, button='left') — click at pixel (x, y)
keyboard_type(text) — type into focused field
scroll(delta_x, delta_y) — scroll by pixel delta
scroll_at(x, y, delta_x, delta_y) — scroll at position (x, y)
goto(url) — navigate to URL
go_back() — browser back
keyboard_press(key) — press a key (Enter, Tab, Escape…)
new_tab() — open new tab
tab_focus(index) — switch to tab by index
send_msg_to_user(message) — report result to user (terminal action)
Coordinates are pixel values relative to a 1920×1200 viewport.
Evaluated on 20 held-out trajectories (314 steps) from MolmoWeb-HumanTrajs (indices 2000–2019) using teacher-forced ground-truth history (mirrors training format).
| Metric | Baseline (QAT bf16, no adapter) | Run 14 fine-tuned | Delta |
|---|---|---|---|
| Action valid | 285 / 314 (91%) | 308 / 314 (98%) | +23 |
| Action match | 126 / 314 (40%) | 209 / 314 (67%) | +27 pp |
| Coords valid | 203 / 314 (65%) | 113 / 314 (36%) | −29 pp |
| Has reasoning | 32 / 314 (10%) | 314 / 314 (100%) | +90 pp |
| Coord L2 (px) | 326.1 (85 steps) | 303.2 (76 steps) | −22.9 px |
Action match +27 pp is the headline result — the model learned the action vocabulary well. Coordinate regression (−29 pp) is the main open issue: the fine-tuned model produces fewer click/scroll steps and more out-of-range coordinates; this is the next thing to fix.
Full per-step results are in eval_run14_results.json in this repository.
import torch
from peft import PeftModel
from transformers import AutoProcessor, AutoModelForImageTextToText
from PIL import Image
BASE = "google/gemma-4-12B-it-qat-q4_0-unquantized"
ADAPTER = "medelharchaoui/gemma4-12b-browser-agent-run14"
processor = AutoProcessor.from_pretrained(BASE)
base = AutoModelForImageTextToText.from_pretrained(
BASE, torch_dtype=torch.bfloat16, device_map="auto"
)
model = PeftModel.from_pretrained(base, ADAPTER)
model.eval()
# screenshot: PIL.Image of the current browser state (1920×1200 recommended)
screenshot = Image.open("screenshot.png").convert("RGB")
task = "Go to https://www.google.com/ and search for 'latest AI news'"
SYSTEM_PROMPT = (
"You are a web navigation agent. You see a screenshot of the current browser state "
"and a task to complete. Think through what to do next, then output exactly one action.\n\n"
"Available actions (coordinates are pixel values):\n"
" mouse_click(x, y, button='left')\n"
" keyboard_type(text)\n"
" scroll(delta_x, delta_y)\n"
" scroll_at(x, y, delta_x, delta_y)\n"
" goto(url)\n"
" go_back()\n"
" keyboard_press(key)\n"
" new_tab()\n"
" tab_focus(index)\n"
" send_msg_to_user(message)\n\n"
"When provided, 'Previous actions' lists what you have already done in this task."
)
messages = [
{"role": "system", "content": [{"type": "text", "text": SYSTEM_PROMPT}]},
{"role": "user", "content": [
{"type": "image", "image": screenshot},
{"type": "text", "text": f"Task: {task}"},
]},
]
prompt = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = processor(
text=prompt, images=[[screenshot]],
return_tensors="pt", truncation=True, max_length=3072,
).to(model.device)
with torch.inference_mode():
out = model.generate(**inputs, max_new_tokens=128, do_sample=False)
response = processor.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
print(response)
# Example output:
# I can see the browser is open. I will navigate to Google.com to start the task.
# goto(url='https://www.google.com/')
Training code and eval scripts: OptimiAI/Gemma-browser (private repo).
To resume from this checkpoint:
# in src/train.py, set:
ADAPTER_PATH = "medelharchaoui/gemma4-12b-browser-agent-run14"
# and pass resume_from_checkpoint=ADAPTER_PATH to SFTTrainer