Views
No views yet
| 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) |
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)| 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 |
eval_run14_results.json in this repository.1import torch
2from peft import PeftModel
3from transformers import AutoProcessor, AutoModelForImageTextToText
4from PIL import Image
5
6BASE = "google/gemma-4-12B-it-qat-q4_0-unquantized"
7ADAPTER = "medelharchaoui/gemma4-12b-browser-agent-run14"
8
9processor = AutoProcessor.from_pretrained(BASE)
10base = AutoModelForImageTextToText.from_pretrained(
11 BASE, torch_dtype=torch.bfloat16, device_map="auto"
12)
13model = PeftModel.from_pretrained(base, ADAPTER)
14model.eval()
15
16# screenshot: PIL.Image of the current browser state (1920×1200 recommended)
17screenshot = Image.open("screenshot.png").convert("RGB")
18task = "Go to https://www.google.com/ and search for 'latest AI news'"
19
20SYSTEM_PROMPT = (
21 "You are a web navigation agent. You see a screenshot of the current browser state "
22 "and a task to complete. Think through what to do next, then output exactly one action.\n\n"
23 "Available actions (coordinates are pixel values):\n"
24 " mouse_click(x, y, button='left')\n"
25 " keyboard_type(text)\n"
26 " scroll(delta_x, delta_y)\n"
27 " scroll_at(x, y, delta_x, delta_y)\n"
28 " goto(url)\n"
29 " go_back()\n"
30 " keyboard_press(key)\n"
31 " new_tab()\n"
32 " tab_focus(index)\n"
33 " send_msg_to_user(message)\n\n"
34 "When provided, 'Previous actions' lists what you have already done in this task."
35)
36
37messages = [
38 {"role": "system", "content": [{"type": "text", "text": SYSTEM_PROMPT}]},
39 {"role": "user", "content": [
40 {"type": "image", "image": screenshot},
41 {"type": "text", "text": f"Task: {task}"},
42 ]},
43]
44prompt = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
45inputs = processor(
46 text=prompt, images=[[screenshot]],
47 return_tensors="pt", truncation=True, max_length=3072,
48).to(model.device)
49
50with torch.inference_mode():
51 out = model.generate(**inputs, max_new_tokens=128, do_sample=False)
52
53response = processor.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
54print(response)
55# Example output:
56# I can see the browser is open. I will navigate to Google.com to start the task.
57# goto(url='https://www.google.com/')1# in src/train.py, set:
2ADAPTER_PATH = "medelharchaoui/gemma4-12b-browser-agent-run14"
3# and pass resume_from_checkpoint=ADAPTER_PATH to SFTTrainer