Recent advances in Vision-Language Models have enabled the development of agents capable of automating interactions with graphical user interfaces. Some computer use agents demonstrate strong performance, while they are typically built on closed-source models or inaccessible proprietary datasets. Moreover, the existing open-source datasets still remain insufficient for developing cross-platform general-purpose computer-use agents. To bridge this gap, we scale up the computer use dataset, constructed via a novel dual-loop interactive pipeline that combines an automated agent and a human expert into data collection. It spans
6 operating systems and
3 task domains, offering a large-scale and diverse corpus for training computer use agents.
Building on this corpus, we develop
ScaleCUA, capable of seamless operation across heterogeneous platforms. Trained on our dataset, it delivers consistent gains on several benchmarks, improving absolute success rates by
+26.6 points on WebArena-Lite-v2 and
+10.7 points on ScreenSpot-Pro compared to the baseline. Moreover, our ScaleCUA family achieves state-of-the-art performance across multiple benchmarks, e.g.,
94.4% on MMBench-GUI L1-Hard,
60.6% on OSWorld-G and
47.4% on WebArena-Lite-v2. These results highlight the effectiveness of our data-centric methodology in scaling both GUI understanding, grounding, and cross-platform task completion. We make our data, models, and code publicly available to facilitate future research:
https://github.com/OpenGVLab/ScaleCUA.
1from transformers import Qwen2_5_VLForConditionalGeneration, AutoTokenizer, AutoProcessor
2from qwen_vl_utils import process_vision_info
3
4# default: Load the model on the available device(s)
5model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
6 "OpenGVLab/ScaleCUA-3B", torch_dtype="auto", device_map="auto"
7)
8
9min_pixels = 3136
10max_pixels = 2109744
11processor = AutoProcessor.from_pretrained("OpenGVLab/ScaleCUA-3B", min_pixels=min_pixels, max_pixels=max_pixels)
For tasks that require direct GUI grounding (e.g., identifying and clicking a specific button from a description) or serve as grounder in agentic workflow, you can use the Direct Action Mode. This mode focuses on generating immediate, executable actions based on the visual input.
1SCALECUA_SYSTEM_PROMPT_GROUNDER = '''You are an autonomous GUI agent capable of operating on desktops, mobile devices, and web browsers. Your primary function is to analyze screen captures and perform appropriate UI actions to complete assigned tasks.
2
3## Action Space
4def click(
5x: float | None = None,
6y: float | None = None,
7clicks: int = 1,
8button: str = "left",
9) -> None:
10"""Clicks on the screen at the specified coordinates. The `x` and `y` parameter specify where the mouse event occurs. If not provided, the current mouse position is used. The `clicks` parameter specifies how many times to click, and the `button` parameter specifies which mouse button to use ('left', 'right', or 'middle')."""
11pass
12
13def doubleClick(
14x: float | None = None,
15y: float | None = None,
16button: str = "left",
17) -> None:
18"""Performs a double click. This is a wrapper function for click(x, y, 2, 'left')."""
19pass
20
21def rightClick(x: float | None = None, y: float | None = None) -> None:
22"""Performs a right mouse button click. This is a wrapper function for click(x, y, 1, 'right')."""
23pass
24
25def moveTo(x: float, y: float) -> None:
26"""Move the mouse to the specified coordinates."""
27pass
28
29def dragTo(
30x: float | None = None, y: float | None = None, button: str = "left"
31) -> None:
32"""Performs a drag-to action with optional `x` and `y` coordinates and button."""
33pass
34
35def swipe(
36from_coord: tuple[float, float] | None = None,
37to_coord: tuple[float, float] | None = None,
38direction: str = "up",
39amount: float = 0.5,
40) -> None:
41"""Performs a swipe action on the screen. The `from_coord` and `to_coord` specify the starting and ending coordinates of the swipe. If `to_coord` is not provided, the `direction` and `amount` parameters are used to determine the swipe direction and distance. The `direction` can be 'up', 'down', 'left', or 'right', and the `amount` specifies how far to swipe relative to the screen size (0 to 1)."""
42pass
43
44def long_press(x: float, y: float, duration: int = 1) -> None:
45"""Long press on the screen at the specified coordinates. The `duration` specifies how long to hold the press in seconds."""
46pass
47
48## Input Specification
49- Screenshot of the current screen + task description
50
51## Output Format
52<action>
53[A set of executable action command]
54</action>
55
56## Note
57- Avoid action(s) that would lead to invalid states.
58- The generated action(s) must exist within the defined action space.
59- The generated action(s) should be enclosed within <action></action> tags.'''
1low_level_instruction = "Click the 'X' button in the upper right corner of the pop-up to close it and access the car selection options."
2
3messages = [
4 {
5 "role": "system",
6 "content":[
7 {
8 "type": "text",
9 "text": SCALECUA_SYSTEM_PROMPT_GROUNDER,
10 }
11 ]
12 },
13 {
14 "role": "user",
15 "content": [
16 {
17 "type": "image",
18 "image": "/path/to/your/image",
19 },
20 {"type": "text", "text": low_level_instruction},
21 ],
22 }
23]
24
25# Preparation for inference
26text = processor.apply_chat_template(
27 messages, tokenize=False, add_generation_prompt=True
28)
29image_inputs, video_inputs = process_vision_info(messages)
30inputs = processor(
31 text=[text],
32 images=image_inputs,
33 videos=video_inputs,
34 padding=True,
35 return_tensors="pt",
36)
37inputs = inputs.to("cuda")
38
39# Inference: Generation of the output
40generated_ids = model.generate(**inputs, max_new_tokens=128)
41generated_ids_trimmed = [
42 out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
43]
44output_text = processor.batch_decode(
45 generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
46)
47print(output_text)
1from qwen_vl_utils import smart_resize
2
3def parse_scalecua_grounder_response(response, image_width: int, image_height: int, resized_width: int, resized_height: int) -> List[str]:
4 response = response.strip()
5 logger.info(f"Extracting coordinates from: {response}")
6 match = re.search(r"\((\d+),\s*(\d+)\)", response)
7 if not match:
8 pattern = r'\((?:x=)?([-+]?\d*\.\d+|\d+)(?:,\s*(?:y=)?([-+]?\d*\.\d+|\d+))?\)'
9 match = re.search(pattern, response)
10 x = int(float(match.group(1)) / resized_width * width)
11 y = int(float(match.group(2)) / resized_height * height) if match.group(2) else None
12 if y is not None:
13 return (x, y)
14
15
16resize_h, resize_w = smart_resize(image_height, image_width, min_pixels=min_pixels, max_pixels=max_pixels)
17x, y = parse_scalecua_grounder_response(output_text, image_width, image_height, resize_w, resize_h)
1SCALECUA_SYSTEM_PROMPT_AGENT = '''You are an autonomous GUI agent operating on the **Linux (Ubuntu)** platform. Your primary function is to analyze screen captures and perform appropriate UI actions to complete assigned tasks.
2
3## Action Space
4def click(
5 x: float | None = None,
6 y: float | None = None,
7 clicks: int = 1,
8 button: str = "left",
9) -> None:
10 """Clicks on the screen at the specified coordinates. The `x` and `y` parameter specify where the mouse event occurs. If not provided, the current mouse position is used. The `clicks` parameter specifies how many times to click, and the `button` parameter specifies which mouse button to use ('left', 'right', or 'middle')."""
11 pass
12
13
14def doubleClick(
15 x: float | None = None,
16 y: float | None = None,
17 button: str = "left",
18) -> None:
19 """Performs a double click. This is a wrapper function for click(x, y, 2, 'left')."""
20 pass
21
22
23def rightClick(x: float | None = None, y: float | None = None) -> None:
24 """Performs a right mouse button click. This is a wrapper function for click(x, y, 1, 'right')."""
25 pass
26
27
28def scroll(clicks: int, x: float | None = None, y: float | None = None) -> None:
29 """Performs a scroll of the mouse scroll wheel at the specified coordinates. The `clicks` specifies how many clicks to scroll. The direction of the scroll (vertical or horizontal) depends on the underlying operating system. Normally, positive values scroll up, and negative values scroll down."""
30 pass
31
32
33def moveTo(x: float, y: float) -> None:
34 """Move the mouse to the specified coordinates."""
35 pass
36
37
38def dragTo(
39 x: float | None = None, y: float | None = None, button: str = "left"
40) -> None:
41 """Performs a drag-to action with optional `x` and `y` coordinates and button."""
42 pass
43
44
45def press(keys: str | list[str], presses: int = 1) -> None:
46 """Performs a keyboard key press down, followed by a release. The function supports pressing a single key or a list of keys, multiple presses, and customizable intervals between presses."""
47 pass
48
49
50def hotkey(*args: str) -> None:
51 """Performs key down presses on the arguments passed in order, then performs key releases in reverse order. This is used to simulate keyboard shortcuts (e.g., 'Ctrl-Shift-C')."""
52 pass
53
54
55def keyDown(key: str) -> None:
56 """Performs a keyboard key press without the release. This will put that key in a held down state."""
57 pass
58
59
60def keyUp(key: str) -> None:
61 """Performs a keyboard key release (without the press down beforehand)."""
62 pass
63
64
65def write(message: str) -> None:
66 """Write the specified text."""
67 pass
68
69
70def call_user() -> None:
71 """Call the user."""
72 pass
73
74
75def wait(seconds: int = 3) -> None:
76 """Wait for the change to happen."""
77 pass
78
79
80def response(answer: str) -> None:
81 """Answer a question or provide a response to an user query."""
82 pass
83
84
85def terminate(status: str = "success", info: str | None = None) -> None:
86 """Terminate the current task with a status. The `status` specifies the termination status ('success', 'failure'), and the `info` can provide additional information about the termination."""
87 pass
88
89
90## Input Specification
91- Screenshot of the current screen + task description + your past interaction history with UI to finish assigned tasks.
92
93## Output Format
94<think>
95[Your reasoning process here]
96</think>
97<operation>
98[Next intended operation description]
99</operation>
100<action>
101[A set of executable action command]
102</action>
103
104## Note
105- Avoid actions that would lead to invalid states.
106- The generated action(s) must exist within the defined action space.
107- The reasoning process, operation and action(s) in your response should be enclosed within <think></think>, <operation></operation> and <action></action> tags, respectively.'''
1SCALECUA_USER_PROMPT = '''Please generate the next move according to the UI screenshot, the task and previous operations.
2
3Task:
4{instruction}
5
6Previous operations:
7{history}
8'''
9
10def format_history(history):
11 if len(history) > 0:
12 actions_history = [f"Step {i+1}: {low_level}" for i, low_level in enumerate(history)]
13 return "\n".join(actions_history)
14 else:
15 return None
16
17history = ["Click on 'Chrome'", "Click on the three-dot menu icon in the top right corner of the Chrome window to open the browser settings menu."]
18step_history = format_history(history)
19
20task_instruction = "I want to check my password information in Chrome"
21user_prompt = SCALECUA_USER_PROMPT.format(
22 instruction=task_instruction,
23 history=step_history,
24)
25
26
27messages = [
28 {
29 "role": "system",
30 "content":[
31 {
32 "type": "text",
33 "text": SCALECUA_SYSTEM_PROMPT_AGENT,
34 }
35 ]
36 },
37 {
38 "role": "user",
39 "content": [
40 {
41 "type": "image",
42 "image": "/path/to/your/image",
43 },
44 {"type": "text", "text": user_prompt},
45 ],
46 }
47]
48text = processor.apply_chat_template(
49 messages, tokenize=False, add_generation_prompt=True
50)
51image_inputs, video_inputs = process_vision_info(messages)
52inputs = processor(
53 text=[text],
54 images=image_inputs,
55 videos=video_inputs,
56 padding=True,
57 return_tensors="pt",
58)
59inputs = inputs.to("cuda")
60
61# Inference: Generation of the output
62generated_ids = model.generate(**inputs, max_new_tokens=4096)
63generated_ids_trimmed = [
64 out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
65]
66output_text = processor.batch_decode(
67 generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
68)
69print(output_text)
1def parse_response(response: str) -> Dict:
2 action_matches = re.findall(r'<action>\s*(.*?)\s*</action>', response, re.DOTALL)
3 actions = []
4 if action_matches:
5 for match in action_matches:
6 # Split each match by newline and strip whitespace from each line
7 lines = [line.strip() for line in match.split('\n') if line.strip()]
8 actions.extend(lines)
9 operation_match = re.search(r'<operation>\s*(.*?)\s*</operation>', response, re.DOTALL)
10 operation = operation_match.group(1).strip() if operation_match else None
11
12 think_match = re.search(r'<think>\s*(.*?)\s*</think>', response, re.DOTALL)
13 think = think_match.group(1).strip() if think_match else None
14
15 return (think, operation, actions)
16
17def parse_actions(self, actions):
18 parsed_action = []
19 for action in actions:
20 match = re.match(r"(\w+)\((.*)\)", action)
21 if not match:
22 return None
23
24 func_name = match.group(1)
25 args_str = match.group(2)
26 args = {}
27
28 if 'hotkey' in func_name.lower():
29 keys = re.findall(r"'(.*?)'", args_str)
30 keys = [key.lower() for key in keys]
31 args["args"] = keys
32 elif 'press' in func_name.lower():
33 keys = None
34 presses = 1
35 presses_match = re.search(r"presses\s*=\s*(\d+)", args_str)
36 if presses_match:
37 presses = int(presses_match.group(1))
38 args_str = args_str[:presses_match.start()] + args_str[presses_match.end():]
39 args_str = args_str.rstrip(", ").strip()
40
41 keys_keyword_match = re.search(r"keys\s*=\s*(.*)", args_str, re.DOTALL)
42 if keys_keyword_match:
43 keys_str = keys_keyword_match.group(1).strip()
44 if (keys_str.startswith("'") and keys_str.endswith("'")) or \
45 (keys_str.startswith('"') and keys_str.endswith('"')):
46 keys_str = keys_str[1:-1]
47 elif keys_str.startswith("[") and keys_str.endswith("]"):
48
49 keys_str = ast.literal_eval(keys_str)
50 keys = keys_str
51 elif args_str:
52 keys_str = args_str.strip()
53 if (keys_str.startswith("'") and keys_str.endswith("'")) or \
54 (keys_str.startswith('"') and keys_str.endswith('"')):
55 keys_str = keys_str[1:-1]
56 keys = keys_str
57
58 args["keys"] = keys
59 args["presses"] = presses
60 elif 'scroll' in func_name.lower():
61 clicks, x, y = None, None, None
62 if '=' in args_str:
63 kwargs = dict(re.findall(r'(\w+)\s*=\s*(-?\d+)', args_str))
64
65 clicks = int(kwargs.get('clicks')) if kwargs.get('clicks') is not None else None
66 x = int(kwargs.get('x')) if kwargs.get('x') is not None else None
67 y = int(kwargs.get('y')) if kwargs.get('y') is not None else None
68
69 elif args_str:
70 try:
71 clicks = int(args_str)
72 except ValueError:
73 pass
74
75 if clicks: args['clicks'] = clicks
76 if x: args['x'] = x
77 if y: args['y'] = y
78
79 else:
80 if "=" in args_str:
81 for arg in re.finditer(r"(\w+)=\[([^\]]+)\]", args_str):
82 param = arg.group(1)
83 list_str = arg.group(2)
84
85 list_items = []
86 for item in re.finditer(r"'([^']*)'|\"([^\"]*)\"|([^,\]]+)", list_str):
87 val = (item.group(1) or item.group(2) or item.group(3)).strip()
88 if val:
89 list_items.append(val.strip('"\''))
90
91 args[param] = list_items
92
93
94 for arg in re.finditer(r"(\w+)=([^,)]+)", args_str):
95 param = arg.group(1)
96 if param in args:
97 continue
98
99 value_str = arg.group(2).strip()
100
101 if value_str.isdigit():
102 value = int(value_str)
103 elif value_str.replace(".", "", 1).isdigit():
104 value = float(value_str)
105 elif value_str.lower() in ("true", "false"):
106 value = value_str.lower() == "true"
107 else:
108 value = value_str.strip('"\'')
109
110 args[param] = value
111
112
113 else:
114 args_list = []
115 for arg in re.finditer(r"'([^']*)'|\"([^\"]*)\"|([^,]+)", args_str):
116 val = (arg.group(1) or arg.group(2) or arg.group(3)).strip()
117 if val:
118 args_list.append(val.strip('"\''))
119
120 if args_list:
121 args["args"] = args_list
122
123 parsed_action.append({
124 'name': func_name,
125 'parameters': args
126 })
127
128think, operation, actions = parse_response(output_text)
129structured_actions = parse_actions(actions)
1from qwen_vl_utils import smart_resize
2
3resize_h, resize_w = smart_resize(image_height, image_width, min_pixels=min_pixels, max_pixels=max_pixels)
4for action in actions
5 if 'x' in action['parameters'] :
6 x = "{:.4f}".format(float(x) / resize_w * image_width)
7 action['parameters']['x'] = x
8 if 'y' in action['parameters']
9 y = "{:.4f}".format(float(y) / resize_h * image_height)
10 action['parameters']['y'] = y
1@article{liu2025scalecua,
2 title = {ScaleCUA: Scaling Open-Source Computer Use Agents with Cross-Platform Data},
3 author = {Liu, Zhaoyang and Xie, Jingjing and Ding, Zichen and Li, Zehao and Yang, Bowen and Wu, Zhenyu and Wang, Xuehui and Sun, Qiushi and Liu, Shi and Wang, Weiyun and Ye, Shenglong and Li, Qingyun and Dong, Xuan and Yu, Yue and Lu, Chenyu and Mo, YunXiang and Yan, Yao and Tian, Zeyue and Zhang, Xiao and Huang, Yuan and Liu, Yiqian and Su, Weijie and Luo, Gen and Yue, Xiangyu and Qi, Biqing and Chen, Kai and Zhou, Bowen and Qiao, Yu and Chen, Qifeng and Wang, Wenhai},
4 year = {2025},
5 url = {https://github.com/OpenGVLab/ScaleCUA}
6}