LLM 应该如何看待计算机?
How should an LLM see a computer?

原始链接: https://www.greptile.com/blog/trex-computer-use

Claude Code 和 Codex 都能通过截图加无障碍树控制计算机;无障碍树是对 UI 元素的文本描述,最初是为屏幕阅读器创建的。按坐标点击容易出错,尤其对小目标和不同分辨率。在 172 个 OSWorld 任务的实验中,较弱的模型在提供无障碍树、尤其是按 ID 而非坐标点击元素时显著提升。较强的模型仅靠截图就得分高,从树或 ID 点击中获益很少。无障碍树也有空白,如画布、游戏或溢出文本,因此截图仍然必不可少。基于这些结果,QA 代理 TREX 在每一步都依赖截图,可用时使用无障碍树 ID 点击,否则回退到坐标。TREX 在真实桌面上运行拉取请求变更,以捕获代码审查遗漏的 UI 缺陷。

一个 Hacker News 帖子讨论 LLM 应该如何“看见”一台电脑。评论者就视觉、无障碍和架构方案展开辩论。有人建议视觉模型可以在图像中标记按钮,计算机视觉可将这些掩码转换为点击坐标。另一人说暴露无障碍树并按 ID 点击可提高一致性。还有人认为让 LLM 查看屏幕会浪费令牌,除非必要,例如在游戏中,而编程框架已经可以调试 UI。一名评论者指出智能体常常笨拙并使用不必要的令牌。还有一道哲学问题:电脑是“它们的”还是“我们的”;发帖者认为很可能是我们的。另一人提议分析并修改二进制文件,直接发送按钮事件。总体而言,讨论突出了视觉、无障碍、效率与系统设计之间的权衡,但没有达成明确共识。
相关文章

原文

Claude Code and Codex can both use your computer. Under the hood they work in a similar manner: both can give the model a screenshot and an accessibility tree, a text description of every button on screen, and let it click by position or by naming an element.

The text version of the screen was built decades ago, for people who couldn’t see it. In 1984, two IBM mathematicians, Jim Thatcher and his former thesis adviser, Jesse Wright, who was blind, started a side project to read the PC’s screen out loud. When GUIs turned the screen into pixels, apps had to start describing themselves instead. Microsoft shipped Active Accessibility in 1997, Sun started AT-SPI for Linux in 2001, and Apple added its Accessibility API in 2002.

This text has been useful for agents too. On the 2024 OSWorld benchmark, models looking only at screenshots completed about one task in twenty, while most models reading the screen as text did better.

How do those results hold up with stronger models? We tested screenshots on their own and with the accessibility tree on seven models, and used the results to decide how our QA agent, TREX, should see the screen.

Hover a square to see its score.

Mean OSWorld score on the same 172 tasks, by model in release order.

A person clicks a button by moving the mouse to it. A model, on the other hand, looks at a screenshot and has to write the coordinates out as text (e.g., ‘x=523, y=217’) before clicking on it. Getting these numbers off by a few pixels can mean it clicks the wrong thing.

The same button sits at different coordinates on different screen and window sizes, so the guesses get worse when the resolution changes.

Also, the model’s vision works against it as it doesn’t see a screenshot pixel by pixel. The image is initially shrunk to fit the model's size limit, then cut into tiny squares, each dozens of pixels wide. But a click still has to land on one exact pixel.

Small targets are hard. On ScreenSpot-Pro, a 2025 benchmark with tiny targets on high resolution screens, the best model at release hit the right target only 18.9% of the time. Anthropic’s own docs warn that Claude “might make mistakes or hallucinate when outputting specific coordinates.”

When OSWorld came out in 2024, human testers were able to complete 72% of its tasks, and the best model about 12%. The authors found that models struggled with two things: turning ‘click Save’ into the right point on the screen, and knowing how to operate the software.

The first problem has a seemingly obvious fix. The accessibility tree already reveals each button's location, so the model doesn't have to go through the trouble of finding pixels. Go one step further, and the model doesn’t even need coordinates; it can pick a button by ID and let the harness click it. To test this, we built three setups, each building upon the last:

  1. Screenshots alone
  2. Adding an accessibility tree (clicking by coordinates)
  3. Adding clicks by element IDs

Every setup used the same agent on 172 OSWorld tasks, with one attempt per task, a 50-step limit and low reasoning effort, scored by OSWorld’s own graders.

The model runs in a loop where it first sees a screenshot and past actions, picks an action (click coordinates, type or press keys), and then looks at the changes. It’s the simplest way to give a model a computer, and the one most agents start with. OSWorld’s baseline agent supports it, and Anthropic described its first computer use model as looking at screenshots and counting how many pixels to move the cursor.

We ran the same screenshot agent across seven OpenAI models:

ModelReleasedScreenshots only
GPT-4oMay 202410.5%
GPT-4.1Apr 20255.4%
GPT-5.2Dec 202515.8%
GPT-5.4 nanoMar 20267.5%
GPT-5.5Apr 202667.7%
GPT-6 LunaSep 202659.2%
GPT-6.1 SolSep 202683.8%

On our 172 tasks, GPT-4.1 scored a mere 5.4% with screenshots alone, while the more recent GPT-6.1 Sol scored 83.8%. On the much harder OSWorld 2.0 offline set, OpenAI reports a score of 71.4% for GPT-6.1 Sol at maximum reasoning effort. The gap between the two models raised questions: do stronger models even need the tree, and can it help weaker ones catch up?

Here, the model sees the screenshot with an accessibility tree beside it. We were interested in the tree because it can just tell the model what’s there, like a button labeled “Save” and where it sits. The model still clicks by coordinates here. The tree lists each element's position and dimensions in pixels, so the model can work out where to click after doing the math. With the clicking kept constant, the only thing that changed was what the model saw.

Save AsNamenotes.txtDocumentsDownloadsDesktopCancelSave

Hover the tree or the screen.

Each line provides an element's position and size in pixels. The model has to turn these numbers into a click.

OSWorld runs on Linux, so our agents read AT-SPI. Each app's toolkit, such as GTK or Qt, describes its widgets, and a small bridge passes those descriptions on to any program that asks for them, without any permission prompt. While testing, we realized that GIMP was missing from the tree entirely until we added back an environment variable set at login.

In our evals, trees helped every model that struggled with screenshots. GPT-5.2 went from 15.8% with screenshots alone to 36.2% with the tree added, and GPT-4.1 from 5.4% to 20.6%. On the other hand, strong models barely budged. GPT-6.1 Sol scored 82.7% with the tree, slightly worse than with screenshots alone (83.8%) and none of the three strongest models changed by a statistically significant amount.

Next, we gave each element in the tree an ID. The model can simply name the element it wants and the harness clicks it. This bypasses the problem of clicking the exact pixel.

Click the calculator. Your click stands in for the model’s coordinates, and it drifts a few pixels.

342

47

58

69

7÷

84

95

106

11×

121

132

143

15−

160

17.

18=

19+

App: [app_1] "GNOME Calculator", Window: "Calculator".

[0] window "Calculator"

[1] button "Undo" Shortcut: "Ctrl+Z"

[2] menu button "Mode" Value: "Basic" Actions: [show menu]

[3] text field "Expression" Value: "42" (focused)

[4] button "7"

[5] button "8"

[6] button "9"

[7] button "÷"

… 12 more buttons, [8]–[19]

1 · Model writesclick(x=?, y=?)

2 · Harness doesMoves the mouse to those pixels and clicks. It doesn’t know what’s there.

3 · On screenWhatever sits at that pixel.

The same calculator, two ways to act on it. Coordinates land wherever the numbers say. An ID names the element, so the harness can't miss.

For weaker models, ID clicks boosted performance on top of the tree. GPT-5.2 went from 36.2% with the tree + coordinates to 52.8% when it clicked by ID, and GPT-4.1 from 20.6% to 29.3%. Put together, the tree and ID clicks more than tripled GPT-5.2’s score with screenshots alone (15.8%).

Again, this experiment didn't do much for the strongest models. GPT-6.1 Sol scored 82.7% clicking by coordinates and 82.1% clicking by ID.

For the three strongest models, neither step made a difference. Across both steps, the four weaker models gained 9 to 37 points with the tree and ID clicks, more than doubling their scores in three of four cases. If you’re building on weaker models, the tree is still worth adding.

Figma

Click the toolbar or a shape.

Canvas is invisible

Doom

Click anything on screen.

No tree at all

Overflowing text

Click the button.

Tree says it fits

What’s on screen versus what the accessibility tree reports. Click the screens!

Some apps publish no tree at all. A canvas app like Figma publishes its toolbar buttons, but the canvas itself is just pixels, and a game like Doom is pixels from top to bottom. Even in apps with a good tree, some bugs only show on screen, like text that overflows its box. The screenshot covers all of these.

Code review catches bugs in the diff. Some bugs only exist when the software is running: a button that can’t be clicked, a label that runs off the edge of the window. Until now, catching those took a person opening the app and simulating the user flow. By writing more code and touching more of the UI than any team can check by hand, coding agents have made it hard for programmers to keep up.

That’s why we built computer use into TREX. It runs the changes in your pull request on an actual desktop and uses the app the way a person would, so you can see that the feature you asked for is the one that got built.

How TREX sees the screen came out of these experiments. It runs on the best models and relies on the screenshot at every step. It uses the accessibility tree to click by ID when it can, and coordinates when the tree doesn't have the element, like a canvas or a game.

How a model should see the screen depends on the model, so we'll rerun these experiments each time a new one comes out and update TREX when the answer changes.

When something breaks on screen, TREX catches it, and shows you what happened.

Try TREX on your next pull request.

联系我们 contact @ memedata.com