Run this model with HF Jobs

Run THUSI-Lab/GameDojo-4B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/THUSI-Lab/GameDojo-4B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/THUSI-Lab/GameDojo-4B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/THUSI-Lab/GameDojo-4B. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/THUSI-Lab/GameDojo-4B. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
File size: 15,722 Bytes
18cc280
 
 
 
 
 
bbd9a9a
18cc280
 
 
 
 
 
dab7b31
d71b890
 
 
dab7b31
18cc280
dab7b31
259fe97
3ec26a0
ee2b921
3ec26a0
c199d5b
fb55b07
 
dab7b31
 
 
 
 
 
a814321
 
dab7b31
 
 
 
a814321
9cef24c
 
 
 
fb55b07
 
 
 
 
18cc280
 
 
fb55b07
 
 
 
 
18cc280
 
 
fb55b07
18cc280
 
6da3765
18cc280
 
 
 
 
 
 
 
6da3765
18cc280
 
 
 
 
 
fb55b07
f1b0d31
 
 
d148074
f1b0d31
d148074
f1b0d31
 
d148074
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f1b0d31
 
 
 
d148074
 
 
f1b0d31
 
 
d148074
f1b0d31
d148074
f1b0d31
d148074
f1b0d31
 
d148074
f1b0d31
d148074
f1b0d31
 
d148074
f1b0d31
 
 
 
 
d148074
 
 
 
 
 
 
f1b0d31
 
d148074
f1b0d31
 
 
 
 
 
 
 
 
d148074
f1b0d31
 
d148074
 
 
 
 
 
 
 
f1b0d31
 
 
 
 
 
ab61d61
 
 
 
 
 
 
 
951cde3
ab61d61
 
 
3445871
 
360fffa
3445871
 
 
 
 
 
 
549634c
 
 
 
 
 
 
 
 
 
 
3445871
 
 
 
 
 
549634c
 
 
 
 
 
 
 
 
360fffa
 
 
 
 
 
549634c
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
---
library_name: transformers
pipeline_tag: image-text-to-text
base_model: Qwen/Qwen3.5-4B
base_model_relation: finetune
datasets:
  - THUSI-Lab/GameDojo
tags:
  - gamedojo
  - game-agent
  - computer-use
---

<div style="background-color: #0d0f17; border: 1px solid #232737; border-radius: 12px; color: #eef0f6; padding: 16px 10px; margin: 8px 0 22px;">
<p align="center" style="margin-bottom: 8px;">
  <img src="https://gamedojo-benchmark.github.io/assets/img/logo.webp" alt="GameDojo" width="520" style="display: inline-block; width: 520px; max-width: 100%; height: auto; margin: 0;">
</p>
<h1 align="center" style="color: #eef0f6; font-size: 1.35em; line-height: 1.35; margin-top: 0; margin-bottom: 12px;"><span style="color: #ffd98a;">Game</span><span style="color: #3fd9c6;">Dojo</span>: Benchmarking Real-Time Interactive Agents in Video Games</h1>

<p align="center" style="margin: 6px 0 14px;">
  <a href="https://arxiv.org/abs/2611.30771" style="display: inline-block; margin: 2px;"><img src="https://img.shields.io/badge/Paper-b31b1b?style=for-the-badge&amp;logo=arxiv&amp;logoColor=white" alt="Paper (arXiv)" style="display: inline-block; vertical-align: middle; margin: 0;"></a>
  <a href="https://gamedojo-benchmark.github.io/" style="display: inline-block; margin: 2px;"><img src="https://img.shields.io/badge/Project%20Page-1f6feb?style=for-the-badge&amp;logo=googlechrome&amp;logoColor=white" alt="Project Page" style="display: inline-block; vertical-align: middle; margin: 0;"></a>
  <a href="https://github.com/THUSI-Lab/GameDojo" style="display: inline-block; margin: 2px;"><img src="https://img.shields.io/badge/GitHub-232737?style=for-the-badge&amp;logo=github&amp;logoColor=eef0f6" alt="GitHub" style="display: inline-block; vertical-align: middle; margin: 0;"></a>
  <a href="https://huggingface.co/datasets/THUSI-Lab/GameDojo" style="display: inline-block; margin: 2px;"><img src="https://img.shields.io/badge/Dataset%20%26%20Benchmark-ffcc4d?style=for-the-badge&amp;logo=huggingface&amp;logoColor=white" alt="Dataset &amp; Benchmark" style="display: inline-block; vertical-align: middle; margin: 0;"></a>
  <a href="https://huggingface.co/papers/2611.30771" style="display: inline-block; margin: 2px;"><img src="https://img.shields.io/badge/Daily%20Paper-232737?style=for-the-badge&amp;logo=huggingface&amp;logoColor=ffcc4d" alt="Daily Paper" style="display: inline-block; vertical-align: middle; margin: 0;"></a>
</p>

<p align="center" style="background-color: #fff; border-radius: 8px; padding: 4px 1px; margin: 0 auto 14px;">
  <img src="https://gamedojo-benchmark.github.io/assets/img/institutions/tsinghua.jpg" alt="Tsinghua University" height="30" style="display: inline-block; vertical-align: middle; height: 30px; width: auto; margin: 4px 2px;">
  <img src="https://gamedojo-benchmark.github.io/assets/img/institutions/ucas.png" alt="University of Chinese Academy of Sciences" height="27" style="display: inline-block; vertical-align: middle; height: 27px; width: auto; margin: 4px 2px;">
  <img src="https://gamedojo-benchmark.github.io/assets/img/institutions/nus.jpg" alt="National University of Singapore" height="34" style="display: inline-block; vertical-align: middle; height: 34px; width: auto; margin: 4px 2px;">
  <img src="https://gamedojo-benchmark.github.io/assets/img/institutions/hku-bilingual.svg" alt="香港大學 · The University of Hong Kong" height="24" style="display: inline-block; vertical-align: middle; height: 24px; width: auto; margin: 4px 2px;">
  <img src="https://gamedojo-benchmark.github.io/assets/img/institutions/macau.png" alt="University of Macau" height="30" style="display: inline-block; vertical-align: middle; height: 30px; width: auto; margin: 4px 2px;">
</p>

<p align="center" style="line-height: 1.65; margin-bottom: 6px;"><strong style="color: #eef0f6;"><span style="white-space: nowrap;">Kuan Zhang<sup style="color: #ffd98a;">1,*</sup>,</span> <span style="white-space: nowrap;">Zhihao Yang<sup style="color: #ffd98a;">2,*</sup>,</span> <span style="white-space: nowrap;">Yukun Chen<sup style="color: #ffd98a;">2,*</sup>,</span> <span style="white-space: nowrap;">Xingyiliang Yin<sup style="color: #ffd98a;">3</sup>,</span> <span style="white-space: nowrap;">Mingyu Ouyang<sup style="color: #ffd98a;">4</sup>,</span> <span style="white-space: nowrap;">Yue Su<sup style="color: #ffd98a;">5</sup>,</span> <span style="white-space: nowrap;">Xiangnan Wu<sup style="color: #ffd98a;">2</sup>,</span> <span style="white-space: nowrap;">Jiaming Li<sup style="color: #ffd98a;">2</sup>,</span> <span style="white-space: nowrap;">Longze Chen<sup style="color: #ffd98a;">2</sup>,</span> <span style="white-space: nowrap;">Run Luo<sup style="color: #ffd98a;">4</sup>,</span> <span style="white-space: nowrap;">Zirong Chen<sup style="color: #ffd98a;">1</sup>,</span> <span style="white-space: nowrap;">Lu Wang<sup style="color: #ffd98a;">1,†</sup>,</span> <span style="white-space: nowrap;">Yiming Li<sup style="color: #ffd98a;">1,†</sup></span></strong></p>
<p align="center" style="color: rgba(238, 240, 246, 0.62); font-size: 0.9em; line-height: 1.6; margin-top: 0; margin-bottom: 4px;"><span style="display: inline-block; margin: 0 5px;"><sup style="color: #ffd98a;">1</sup> Tsinghua University</span> <span style="display: inline-block; margin: 0 5px;"><sup style="color: #ffd98a;">2</sup> University of the Chinese Academy of Sciences</span> <span style="display: inline-block; margin: 0 5px;"><sup style="color: #ffd98a;">3</sup> University of Macau</span> <span style="display: inline-block; margin: 0 5px;"><sup style="color: #ffd98a;">4</sup> National University of Singapore</span> <span style="display: inline-block; margin: 0 5px;"><sup style="color: #ffd98a;">5</sup> University of Hong Kong</span></p>
<p align="center" style="color: rgba(238, 240, 246, 0.62); font-size: 0.85em; margin: 0;"><span style="display: inline-block; margin: 0 5px;"><sup style="color: #ffd98a;">*</sup> Equal contribution</span> <span style="display: inline-block; margin: 0 5px;"><sup style="color: #ffd98a;">†</sup> Co-corresponding authors</span></p>
</div>

## News

- **2026-12-02** · 🎉 **GameDojo-Data is out!** [Explore 600+ hours of gameplay trajectories](https://huggingface.co/datasets/THUSI-Lab/GameDojo/viewer/default/train).

## Overview

GameDojo-4B is a vision-language model for video game boss encounters. It takes game observations and task context and generates keyboard and mouse actions for the GameDojo computer-use (CUA) interface. Each action chunk covers 200 ms of game control.

GameDojo provides 120 boss encounters across 20 game environments, split evenly between 2D and 3D. Its CUA and Semantic interfaces expose different levels of action abstraction. Real-time and time-paused modes let researchers vary whether the simulation advances during inference.

## Training

We fine-tuned [Qwen3.5-4B](https://huggingface.co/Qwen/Qwen3.5-4B) with supervised learning on a balanced 240-hour subset of GameDojo-Data. The subset contains 40 minutes of gameplay for each of the 120 bosses at each of three difficulty levels (Easy, Medium, and Hard).

## Evaluation

We evaluate GameDojo-4B through CUA in both timing modes at all three difficulty levels. We report average win rate and average progress. A win requires defeating the boss, and progress measures the fraction of total boss health removed during the episode.

## Download

The checkpoint is distributed as BF16 Safetensors. Download it together with its configuration and processor files.

```bash
hf download THUSI-Lab/GameDojo-4B --local-dir GameDojo-4B
```

## Load with Transformers

```python
import torch
from transformers import AutoProcessor, Qwen3_5ForConditionalGeneration

repo_id = "THUSI-Lab/GameDojo-4B"
processor = AutoProcessor.from_pretrained(repo_id)
model = Qwen3_5ForConditionalGeneration.from_pretrained(
    repo_id, dtype=torch.bfloat16, device_map="auto"
).eval()
```

Use the bundled `chat_template.jinja` to format observations and task context. Pass the generated actions to the GameDojo CUA executor to advance the encounter.

## Single-frame CUA example

This example uses the Terraria King Slime CUA system prompt shown in the GameDojo supplementary material. The conversation contains this system prompt and one image-only user turn.

### System prompt for King Slime

```text
You are an experienced PC game player, proficient in keyboard and mouse operations. You are playing "Pixel Arena: Sword and Bow". Based on the current game screen and the corresponding historical trajectory, plan the next 200ms of actions, consisting of 6 steps. Each step is spaced 33ms apart. Every step lasts 33ms from its start time until the next step begins.

Output Format
<|action_start|>X Y Z ; k1 k2 ; k3 ; k4 ; k5 ; k6 ; k7<|action_end|>

Explanation
1. Mouse Movement: Relative integers X, Y in [-1000, 1000] (X>0 right, Y>0 down) and scroll Z in [-5, 5] (Z>0 up).
2. Key Sequence: 6 groups separated by ;; space-separated keys within each group (at most 4 keys/group). Leave an empty group blank while keeping ;. Keys listed in consecutive groups stay held; unlisted keys are released.
3. Output only one plain line matching the format, with no line breaks or quotes.
Key Naming Rules: Capital letters (W, A), capitalized names (Space, Shift), mouse buttons (LB, RB).

Game: Side-view 2D arena with two wooden platforms. Empty the boss's health bar within 300 s without losing all health.
Controls (only these keys are active): A/D move left/right; Space jump/fly; S drop through platform; J/LB use weapon; Q swap sword/bow; E shoot bow at crosshair; RB swing sword.
Mouse: X/Y move crosshair (1000 = full screen width/height); bow shoots toward crosshair.
Boss: King Slime: Giant gel creature that leaps to crush you, sheds small blobs when hit, and teleports near you. Moves: 1. Leap; 2. Teleport; 3. Gel Spawns.
Health bars and other status are shown on the screen; read them yourself.
```

### Input frame

The source frame below is resized to 854 × 480 and JPEG-encoded at quality 90 before inference.

![Terraria King Slime encounter in GameDojo](https://gamedojo-benchmark.github.io/assets/posters/terraria-king-slime.jpg)

### Model output

The published BF16 checkpoint generated this reply with its non-thinking chat template. The run used Transformers 5.24.0 on Apple MPS, sampling at temperature 1.0 with top-p 1.0, no top-k cutoff, and a 256-token limit. Generation stopped upon emitting `<|action_end|>`.

<pre style="white-space: pre-wrap; overflow-wrap: anywhere;"><code style="white-space: inherit; overflow-wrap: inherit;">&lt;|action_start|&gt;-7 33 0 ; E S ; E S ; E S ; E S ; E S ; E S&lt;|action_end|&gt;</code></pre>

The mouse deltas move the crosshair left and down, with no scroll. Each of the six steps holds `E` to shoot the bow and `S` to drop through the platform.

<details>
<summary>Run the same example with Transformers</summary>

Load `processor` and `model` as shown above. Save the system prompt as `king_slime_cua_prompt.txt` and the source image as `king-slime.jpg`.

```python
from io import BytesIO
from pathlib import Path

from PIL import Image
import torch

system_prompt = Path("king_slime_cua_prompt.txt").read_text(encoding="utf-8").rstrip("\n")
with Image.open("king-slime.jpg") as source:
    encoded = BytesIO()
    resized = source.convert("RGB").resize((854, 480), Image.Resampling.LANCZOS)
    resized.save(encoded, format="JPEG", quality=90)
frame = Image.open(encoded).convert("RGB")

messages = [
    {"role": "system", "content": system_prompt},
    {"role": "user", "content": [{"type": "image", "image": frame}]},
]
inputs = processor.apply_chat_template(
    messages,
    add_generation_prompt=True,
    tokenize=True,
    return_dict=True,
    return_tensors="pt",
).to(model.device)

torch.manual_seed(42)
with torch.inference_mode():
    output = model.generate(
        **inputs,
        do_sample=True,
        temperature=1.0,
        top_p=1.0,
        top_k=0,
        max_new_tokens=256,
        stop_strings=["<|action_end|>"],
        tokenizer=processor.tokenizer,
    )
new_ids = output[0, inputs["input_ids"].shape[-1]:].tolist()
print(processor.decode(new_ids, skip_special_tokens=False, clean_up_tokenization_spaces=False))
```

</details>

## Citation

```bibtex
@article{zhang2026gamedojo,
  title   = {GameDojo: Benchmarking Real-Time Interactive Agents in Video Games},
  author  = {Zhang, Kuan and Yang, Zhihao and Chen, Yukun and Yin, Xingyiliang and Ouyang, Mingyu and Su, Yue and Wu, Xiangnan and Li, Jiaming and Chen, Longze and Luo, Run and Chen, Zirong and Wang, Lu and Li, Yiming},
  journal = {arXiv preprint arXiv:2611.30771},
  year    = {2026}
}
```

## Related Work

Explore our series on generalist game agents, spanning surveys, scalable training, long-horizon real-time agents, and interactive evaluation. Follow the GitHub repositories for new papers, code, and updates.

### Towards Generalist Game Agents

Our TMLR survey of foundation models in virtual worlds connects datasets, models, agent harnesses, and benchmarks for generalist game agents.

[Project Page](https://thusi-lab.github.io/Awesome-LFMs-Play-Games/) · [GitHub](https://github.com/THUSI-Lab/Awesome-LFMs-Play-Games) · [Paper](https://arxiv.org/abs/2605.09965) · [Hugging Face Paper](https://huggingface.co/papers/2605.09965)

```bibtex
@article{zhang2026towards,
  title={Towards Generalist Game Agents: A Survey of Foundation Models in Virtual Worlds},
  author={Kuan Zhang and Dongchen Liu and Qiyue Zhao and Tianyu Xin and Yue Su and Haisheng Wang and Han Yin and Hongbo Ma and Peize Li and Tianjun Gu and Xiangnan Wu and Xinran Zhang and Yongxuan Li and Zirong Chen and Yiming Li},
  journal={Transactions on Machine Learning Research},
  issn={2835-8856},
  year={2026},
  url={https://openreview.net/forum?id=SDkEq8Fzvl}
}
```

### GameScaling

GameScaling studies how gameplay data, world diversity, and model size scale continued pre-training for keyboard-and-mouse agents across virtual worlds.

[Project Page](https://gamescaling.github.io/) · [GitHub](https://github.com/THUSI-Lab/GameScaling) · [Hugging Face Models](https://huggingface.co/THUSI-Lab/GameScaling) · [Paper](https://arxiv.org/abs/2610.28698)

```bibtex
@article{zhang-scaling-games,
  title = {Scaling in Games: Continued Pre-Training for Embodied Agents in Diverse Virtual Worlds},
  author = {Zhang, Kuan and Chen, Yukun and Yang, Zhihao and Su, Yue and Wu, Xiangnan and Chen, Zirong and Luo, Run and Hou, Jinkun and Tan, Tao and Zheng, Yinhe and Li, Yiming},
  journal = {arXiv preprint arXiv:2610.28698},
  year = {2026}
}
```


### Gamer

A generalist vision-language-action model for long-horizon, real-time gameplay, combining keyboard-and-mouse control, sparse reasoning, persistent memory, and online reinforcement learning.

[Project Page](https://mihoyo-gamer.github.io/) · [GitHub](https://github.com/RainBowLuoCS/Gamer) · [Paper](https://arxiv.org/abs/2611.18397) · [Hugging Face Paper](https://huggingface.co/papers/2611.18397)

```bibtex
@article{luo-gamer,
  title = {Gamer: A Generalist Vision-Language-Action Foundation Model for Long-Horizon Real-Time Game Agent},
  author = {Luo, Run and Zhang, Kuan and Deng, Qi and Chen, Yukun and Yang, Zhihao and Zhang, Yufei and Hu, Renrong and Zhang, Yi and Ma, Guiyu and Fan, Tianyu and Chen, Longze and Sun, Hao and Li, Jiaming and Yang, Jiaming and Liu, Xiaohao and Tan, Tao and Wang, Minzheng and Jia, Hangtian and Yuan, Shuai and Wang, Lvdi and Liu, Xiao and Ma, Chao and Zou, Yuting and Zheng, Yinhe and Xia, Xiaobo and Jiang, Dawei and Ren, Shaoqing},
  journal = {arXiv preprint arXiv:2611.18397},
  year = {2026}
}
```