Skip to content

Add Qwen3.6-VL support via an extensible per-model-family adapter layer - #64

Merged
marksibrahim merged 3 commits into
facebookresearch:mainfrom
jiayuww:feat/qwen3.6-vl-adapters
Jul 30, 2026
Merged

Add Qwen3.6-VL support via an extensible per-model-family adapter layer#64
marksibrahim merged 3 commits into
facebookresearch:mainfrom
jiayuww:feat/qwen3.6-vl-adapters

Conversation

@jiayuww

@jiayuww jiayuww commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds support for the Qwen3.6-VL family (Qwen3.6-27B, Qwen3.6-35B-A3B) and, to do it cleanly, introduces a small per-model-family adapter layer so each model family owns its own response parser and coordinate conversion. Existing configs are unaffected.

Why

Qwen-VL models emit a <tool_call>{...}</tool_call> JSON grammar with coordinates in a 0-1000 space — not UI-TARS's <action>...</action> text with raw pixels. The existing flexible_parser can't read that grammar, and there was no seam to plug in a different one without scattering model-specific logic through utils.py. This PR adds that seam.

What changed

New src/open_apps/agent/adapters/ package

  • base.pyAdapter contract: parse(response, viewport) -> {action, displayed_action, think}.
  • uitars.py — default family; delegates to the existing flexible_parser (unchanged behavior).
  • qwen3vl.py — self-contained <tool_call> JSON parser + 0-1000→viewport coordinate rescale.
  • __init__.pyREGISTRY + get_adapter(); select a family with adapter: in the agent yaml (defaults to uitars).

Wiring (additive, back-compatible)

  • vLLM_agent.py — new adapter and prompt_sections config fields, threaded to the prompt builder.
  • vLLM_prompt.py_parse_answer dispatches to the selected adapter (falls back to flexible_parser); the user message is split into composable sections so a config can render a minimal message (Qwen keeps its <tools> schema in the system prompt, which it was trained to expect); viewport is derived from the screenshot for rescaling. Default configs render byte-for-byte as before.
  • utils.py — JPEG→PNG screenshots (some sglang VLM processors crash on JPEG); empty-content retry guard (empty/None content no longer crashes a trial); hotkey normalization (ctrl aControl+a).

Configs

  • config/agent/Qwen3.6-VL.yaml — the family (adapter + <tools> system prompt + minimal prompt_sections + 5-action set).
  • config/agent/Qwen3.6-27B.yaml, config/agent/Qwen3.6-35B-A3B.yaml — thin per-model configs inheriting the family (like UI-TARS-1.5-7B.yaml).

Tests

  • tests/test_adapters.py — registry, every Qwen action + robustness cases, UI-TARS regression.

Extensibility

Adding a new model family = one adapter module + one REGISTRY line + one config yaml. No changes to the agent/prompt/parse plumbing. If a family needs a new user-message section, add a _render_* method + a _SECTION_RENDERERS entry.

Testing

  • tests/test_adapters.py: 22 passing; full suite green except one pre-existing browser e2e flake unrelated to this change.
  • Smoke-tested against live sglang servers on add_call_mom_to_my_todo: Qwen3.6-27B 4/4, Qwen3.6-35B-A3B 2/4 (the 2 misses are model grounding, not parsing), with 0 parse failures across 8 runs and correct 0-1000→pixel rescaling verified on real output.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 30, 2026
Introduce adapters/ (base contract + registry) so each model family owns its
own response parser and coordinate conversion, selected with `adapter:` in the
agent yaml. Ships two families:
  - uitars (default): delegates to the existing flexible_parser, so every
    existing config renders + parses byte-for-byte as before.
  - qwen3vl: self-contained <tool_call> JSON parser + 0-1000 -> viewport
    coordinate rescale, for Qwen3.6-VL (and Qwen3-VL).

Wiring (additive, back-compatible):
  - vLLM_agent: `adapter` + `prompt_sections` config fields threaded through
    to the prompt builder.
  - vLLM_prompt: _parse_answer dispatches to the selected adapter; the user
    message is split into composable sections so a config can render a minimal
    message (Qwen keeps its <tools> schema in the system prompt, which it was
    trained to expect); viewport is derived from the screenshot for rescaling.
  - utils: JPEG->PNG screenshots (some sglang VLM processors crash on JPEG);
    empty-content retry guard (empty/None content no longer crashes a trial);
    hotkey normalization (ctrl a -> Control+a).

Configs: Qwen3.6-VL family + thin Qwen3.6-27B / Qwen3.6-35B-A3B model configs.
Tests: tests/test_adapters.py (registry, qwen3vl actions + robustness, uitars
regression).

Smoke-tested against live sglang servers on add_call_mom_to_my_todo:
Qwen3.6-27B 4/4, Qwen3.6-35B-A3B 2/4, with 0 parse failures across 8 runs.
@jiayuww
jiayuww force-pushed the feat/qwen3.6-vl-adapters branch from 1c82ed5 to d42cc9d Compare July 30, 2026 00:50

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I quite like the idea of separating action parsers into separate module for each model. Nice idea

Comment thread config/agent/Qwen3.6-VL.yaml Outdated
use_axtree: false
use_screenshot: true

adapter: qwen3vl

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice to include this an argument. I'm just going to rename this arg and corresponding module to action_parser since I find that more intuitive, unless you have any objections.

@marksibrahim

Copy link
Copy Markdown
Contributor

One other change, I'm appending -computer-use to make it clear these are pure computer-use agents

@marksibrahim
marksibrahim merged commit 30e8694 into facebookresearch:main Jul 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants