Instructions to use gsarch/Persistent-Exploration-Gemma4-E4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gsarch/Persistent-Exploration-Gemma4-E4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="gsarch/Persistent-Exploration-Gemma4-E4B") 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("gsarch/Persistent-Exploration-Gemma4-E4B") model = AutoModelForMultimodalLM.from_pretrained("gsarch/Persistent-Exploration-Gemma4-E4B", 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use gsarch/Persistent-Exploration-Gemma4-E4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "gsarch/Persistent-Exploration-Gemma4-E4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gsarch/Persistent-Exploration-Gemma4-E4B", "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" } } ] } ] }'Use Docker
docker model run hf.co/gsarch/Persistent-Exploration-Gemma4-E4B
- SGLang
How to use gsarch/Persistent-Exploration-Gemma4-E4B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "gsarch/Persistent-Exploration-Gemma4-E4B" \ --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": "gsarch/Persistent-Exploration-Gemma4-E4B", "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" } } ] } ] }'Use Docker images
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 "gsarch/Persistent-Exploration-Gemma4-E4B" \ --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": "gsarch/Persistent-Exploration-Gemma4-E4B", "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 Runner
How to use gsarch/Persistent-Exploration-Gemma4-E4B with Docker Model Runner:
docker model run hf.co/gsarch/Persistent-Exploration-Gemma4-E4B
Persistent Exploration (Gemma 4 E4B)
This checkpoint was trained from google/gemma-4-E4B-it using Persistent Exploration, the reinforcement learning method introduced in Learning to Persist for Visual Search.
During training, when the model answers incorrectly, it keeps its earlier zoom history and uses image_zoom_in_tool to inspect another region. The policy learns from both failed attempts and successful retries. At inference, the same policy judges whether to accept an answer or keep searching.
Models
| Model | Base model | Training step |
|---|---|---|
gsarch/Vero2-Gemma4-E4B-Persistent-Exploration |
google/gemma-4-E4B-it |
60 (mass bounds) |
Highlights
On VisualProbe, this checkpoint answered 283/515 (55.0%) overall and 43/106 (40.6%) on Hard (Table 1). The evaluation used a policy critic with retry threshold 0.5, up to ten zooms, a forced final answer at the tool limit, and a Qwen3.5-27B judge.
Usage
The chat template supplies the evaluated system prompt and zoom schema. It uses Gemma 4 native tool calls with normalized [y1, x1, y2, x2] boxes on a 0β1000 grid. To render an image question with Transformers:
from transformers import AutoProcessor
processor = AutoProcessor.from_pretrained("gsarch/Vero2-Gemma4-E4B-Persistent-Exploration")
messages = [{"role": "user", "content": [
{"type": "image", "url": "image.jpg"},
{"type": "text", "text": "\nWhat is written on the sign?\nImage 0 is available as img_idx=0."},
]}]
prompt = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
To execute zooms and score all 515 questions, run the following in a configured Vero2 vero_eval checkout on a GPU node. Set MODEL_DIR and OUTPUT_ROOT to separate directories on scratch, and JUDGE_MODEL_PATH to a local copy of Qwen/Qwen3.5-27B.
hf download gsarch/Vero2-Gemma4-E4B-Persistent-Exploration --local-dir "$MODEL_DIR"
bash "$MODEL_DIR/eval/run_visual_probe.sh"
Gemma uses Transformers 5.8.0.dev0. For the original Vero2 evaluation checkout (2e975b8), apply the release-profile patch from the repository root before running the replay.
The scored run used vLLM 0.23.0, temperature 0.7, top-p 0.8, top-k 20, a 40,960-token context, and up to 4096 generated tokens per policy turn.
Citation
@unpublished{sarch2026persist,
title = {Learning to Persist for Visual Search},
author = {Sarch, Gabriel and Wu, Haoyang and Zhang, Yipeng and Cai, Linrong and Fragkiadaki, Katerina and Chen, Danqi and Liu, Zhuang},
year = {2026},
note = {Manuscript}
}
License
The base model uses Apache 2.0. This checkpoint was trained on VisualProbe. Mini-o3 specifies research use for models trained on its data. Upstream terms.
- Downloads last month
- 21