2026-11-26 15:49 UTC

Qwen4 one-million-token context claim remains unverified

state: watchingheat: lowuncertainty: highrelevance: mediumqwen4 long-context model-rumorQwen

What is this?

A Reddit post interprets a Qwen Code pull request as hinting that future Qwen4 models could support a 1-million-token context window. The post also speculates about release timing, then notes that a displayed Qwen4-Max date may be a placeholder. The supplied evidence does not include the pull request’s contents or an official Qwen announcement confirming the context length or timing. A search result from a secondary site says Qwen 4 is in training, but that does not confirm the 1-million-token claim.

Why it matters

The client-side default could change compaction behavior for users who select Qwen4 IDs, but there is still no demonstrated model capability or user benefit; the assumption could also cause oversized requests.

Current assessment

QwenLM’s Qwen Code PR #15762 was merged on October 28, 2026. It adds a fallback that assigns a 1,000,000-token context limit to Qwen4 model IDs when neither models.dev nor the built-in catalog has an entry; catalog entries take precedence. Unit tests and a CLI demonstration against a fake OpenAI-compatible server establish that Qwen Code reports 1M rather than 262,144 tokens with this rule. They do not establish that any real Qwen4 model supports that context length: the PR says no real Qwen4 endpoint was tested, and flags the broad rule—especially for the multimodal omni variant—as uncertain. Actual model limits, variant differences, release timing, and availability remain unconfirmed. A real million-token window could support much larger code or document sessions, but for now the only established change is client-side behavior, which could also delay compaction and lead to rejected requests if the model’s true limit is lower. The Reddit discussion has peaked and is no longer gaining engagement.

Measured heat

now 0 pts/hpeak 0 pts/hcomments 0/hpeers p0momentum: steady1 platformsage 686h
points/hour across evidence · reading as of 2026-11-27 02:23:58.509736+11:00 · deterministic, not a model opinion

How the heat travelled

11-03 03:55⭐ origin directly observedAlibaba's Qwen Code repo just leaked qwen4-max, qwen4-coder-plus, and qwen4-omni-120b
feelspeaceman on r/LocalLLaMA
—
10-29 01:42first on r/LocalLLaMA · published · +-122.2hQwen4 1M context window
brainExploded99
—
10-29 01:42amplified on r/LocalLLaMAreddit.post.1xi7390
brainExploded99
peak 536 · 231 comments · 38% of case engagement
10-30 15:07amplified on r/LocalLLaMAreddit.post.1xjhwc3
giveen
peak 150 · 52 comments · 10% of case engagement
11-03 03:55amplified on r/LocalLLaMA 👑reddit.post.1xmitzx
feelspeaceman
peak 900 · 134 comments · 52% of case engagement
10-29 02:21our radar first saw it · +-121.6hdiscovery anchor: reddit.post.1xi7390—
pace: p98 vs 1845 stories at the 336h mark (now 686h old) — ahead of huggingface-abliterated-models-disappearing (1.0x), behind postman-agent-plugin-install-consent-claim (1.0x)

Evidence (3) — ⭐ canonical anchor

sourceobjectauthorscorecomments
🟠 redditQwen4 1M context window
LocalLLaMA
brainExploded99536231
🟠 redditQwen4!
LocalLLaMA
giveen15052
🟠 reddit ⭐Alibaba's Qwen Code repo just leaked qwen4-max, qwen4-coder-plus, and qwen4-omni-120b
LocalLLaMA
Retrieved article excerpt

Open article · Retrieved 2026-11-03T04:21:44.395670+00:00

## Repository navigation



# fix(core): size the qwen4 generation at 1M - #15762

#15762

Merged

[wenshao](https://github.com/wenshao) merged 1 commit into

[main](https://github.com/QwenLM/qwen-code/tree/main)QwenLM/qwen-code:mainfrom 

[fix/qwen4-context-window](https://github.com/QwenLM/qwen-code/tree/fix/qwen4-context-window)QwenLM/qwen-code:fix/qwen4-context-windowCopy head branch name to clipboard

Oct 28, 2026

Merged

## [fix(core): size the qwen4 generation at 1M](https://github.com/QwenLM/qwen-code/pull/15762#top)#15762 [wenshao](https://github.com/wenshao) merged 1 commit into [main](https://github.com/QwenLM/qwen-code/tree/main)QwenLM/qwen-code:mainfrom [fix/qwen4-context-window](https://github.com/QwenLM/qwen-code/tree/fix/qwen4-context-window)QwenLM/qwen-code:fix/qwen4-context-windowCopy head branch name to clipboard

## Conversation

[@wenshao](https://github.com/wenshao)

### @wenshao **[wenshao](https://github.com/wenshao)** commented [Oct 28, 2026](https://github.com/QwenLM/qwen-code/pull/15762#issue-6072489462) • edited Loading Uh oh! There was an error while loading. [Please reload this page](https://github.com/QwenLM/qwen-code/pull/15762).

Copy link
 

Copy Markdown

Collaborator

## What this PR does

Extends the context-window detector's Qwen 1M rules to the qwen4 generation. A single family row sits beside the existing qwen3.x row and ahead of the 256K Qwen fallback, so every qwen4 spelling — bare major, dotted minor, coder variants, dated snapshots, provider-prefixed ids — is sized at 1,000,000 without another code change per release. Nothing else moves: output ceilings, input modalities and model-id normalization are untouched, and the models.dev catalog is still consulted first, so the row answers only for ids no upstream source describes and steps aside once the catalog carries one.

## Why it's needed

Follow-up to the review suggestion on [#15758](https://github.com/QwenLM/qwen-code/pull/15758). The 1M rules stopped at `qwen3.x` and no qwen4 entry exists in models.dev or the built-in catalog — checked both in the bundled snapshot and in a fresh fetch of `models.dev/api.json`, neither of which contains a single qwen4 id — so the whole generation fell through to the 256K family row. That is the same symptom that PR fixed for the invite-only series, where auto-compaction fires at roughly 22% of the real window and nothing fails loudly enough to reveal it.

Measured on `main` at `79a9b753c60`, before this change: `qwen4`, `qwen4-max`, `qwen4-plus`, `qwen4.5-max`, `qwen4-coder-plus`, `qwen4-max-2026-10-01`, `openai/qwen4-max` and `qwen4-omni-120b-think` all resolved to 262,144. The last of those is already in use as the session model in the omni fixtures, so these ids are not hypothetical.

This follows the forward-default convention the table already uses for new generations of other families (Gemini 3.x, GLM-5.2+, Kimi K3): the generation is pinned once rather than per minor release.

## Reviewer Test Plan

### How to verify

Point an OpenAI-compatible provider at any qwen4 id (for example `qwen4-max`) and run `/context`. The header should read `Context window: 1000.0k tokens`; before this change the same id reported `Context window: 262.1k tokens`. The detector is reached only on the API-key auth paths — Qwen OAuth admits `coder-model` alone and substitutes it before any window is computed, so that auth type is unaffected either way.

At the unit level, from `packages/core`:

```
npx vitest run src/core/tokenLimits.test.ts
```

Both new tests were checked to redden on their own, one mutant at a time, so neither passes vacuously:

- Sizing the new row at 256K instead of 1M: `should return 1M for the qwen4 generation` fails, 105 of 106 still pass.
- Skipping the catalog branch so the family table answers first: `should let a qwen4 catalog entry outrank the family row` fails on the 400,000 catalog value.

The surrounding suites were run as well — `tokenLimits`, `modalityDefaults`, `model-catalog`, `model-catalog-refresh`, `modelConfigResolver` — 316 passed, plus the three omni suites that carry the `qwen4-omni-120b-think` fixture (90 passed). `prettier --check` and `eslint` are clean on both changed files, and `tsc --noEmit` is clean for the core package. The repository-wide `npm run typecheck` stops in `integrations/generated-ui` on a missing `@jitl/quickjs-singlefile-browser-release-sync` module in this checkout, which is unrelated to these two files.

The product's real `/context` path was also driven end to end against the repository's own `integration-tests/fake-openai-server.ts`, so no qwen4 credentials were needed:

```
qwen -p '/context' --auth-type openai --model qwen4-max \
  --openai-base-url <fake>/v1 --openai-api-key fake-key
```

Run with a scratch `QWEN_HOME` and `QWEN_CODE_MODELS_DEV_REFRESH=off`, from TypeScript source through the `npm run dev` entry point (`scripts/dev.js`) on both arms. The arms differ only by the new rule's limit value in the working tree (1M for head, 256K for base, restored afterwards); nothing else was rebuilt or reconfigured between them.

### Evidence (Before & After)

Captured from the real headless `/context` output, same command and same model id on both arms, exit code 0 each:

```
base: Model: qwen4-max  Context window: 262.1k tokens
head: Model: qwen4-max  Context window: 1000.0k tokens
```

The percentage columns move with the window as expected — the same 25.2k of memory files reads `9.6%` on base and `2.5%` on head. As a non-regression check on the same path, `qwen3-max` still reports `Context window: 262.1k tokens` with the change applied.

|  | Before | After |
| --- | --- | --- |
| Detected context window | 262,144 | 1,000,000 |
| `/context` header (captured) | `262.1k tokens` | `1000.0k tokens` |
| Auto-compaction threshold | ≈222,822 | 850,000 |
| Hard threshold | 239,144 | 977,000 |

The two threshold rows are computed from the window at the source level rather than read off a terminal, since `/context` before the first API response prints the window and the overhead breakdown only. They follow the ladder in `computeThresholds`: `min(0.85 × window, window − 20k − 13k)` for auto and `window − 20k − 3k` for hard.

### Tested on

| OS | Status |
| --- | --- |
| 🍏 macOS | ✅ |
| 🪟 Windows | ⚠️ |
| 🐧 Linux | ⚠️ |

### Environment (optional)

Unit tests, plus the headless CLI run from TypeScript source (`npm run dev`, Node 22.22.2) against the repository's fake OpenAI server, on macOS 26.5.1 / arm64. No real qwen4 endpoint was called.

## Risk & Scope

- Main risk or tradeoff: the row takes the whole qwen4 generation to be 1M, which is reviewer-reported rather than something the code or models.dev can confirm today. If a member of the generation ships a smaller window, the proactive compaction gate keeps running against the inferred 1M, so compaction fires late and a request gets rejected for length. That is recoverable, but it costs at least one failed request: the rejection carries the server's own ceiling into reactive compaction, which sizes the summary and the retry against that ceiling instead of re-posting the oversize history to the endpoint that just refused it. A catalog entry, once published, overrides the row and removes the guess.
- Least certain member of the generation: `qwen4-omni-120b-think`, the one qwen4 id already in use as a session model in the omni fixtures, is a multimodal model, and this row raises its window as well. Neither the repository nor the catalog states its window, and multimodal tiers do not always share the text flagship's. If omni members turn out not to be 1M, that id needs an explicit carve-out ahead of this row — worth a maintainer's confirmation, since the whole-generation rule was requested as a single line.
- Not validated / out of scope: the CLI path was exercised against a fake endpoint, not a real qwen4 one, so the model's actual window is still unconfirmed. The output ceiling is deliberately left at the 32K Qwen family default, since only the context window was reported; qwen4 output limits can be pinned separately when they are known.
- Breaking changes / migration notes: none. The only ids whose answer changes are those beginning with `qwen4`, and only when the catalog has no entry for them. The qwen3 boundaries (`qwen3-max` at 256K, `qwen3.5-plus` at 1M) and the generic Qwen fallback are unchanged.

## Linked Issues

Follow-up to the review suggestion in [#15758 (comment)](https://github.com/QwenLM/qwen-code/pull/15758#issuecomment-6460232584).

中文说明

## 这个 PR 做了什么

把上下文窗口识别逻辑中 Qwen 的 1M 规则扩展到 qwen4 代际。一条家族规则紧邻既有的 qwen3.x 规则、位于 256K 的 Qwen 兜底之前,因此 qwen4 的各种拼写 —— 裸主版本、带点次版本、coder 变体、带日期快照、带 provider 前缀的 id —— 都被判定为 1,000,000,后续每次发版无需再改码。其余一切不变:输出上限、输入模态与模型 id 归一化都未触及,并且仍然优先查询 models.dev 目录,因此这条规则只为那些上游数据源没有描述的 id 作答,一旦目录收录了它们,规则就自动让位。

## 为什么需要

这是 [#15758](https://github.com/QwenLM/qwen-code/pull/15758) 评审建议的后续。1M 规则到 `qwen3.x` 为止,而 models.dev 与内置目录都没有 qwen4 条目 —— 内置快照与新拉取的 `models.dev/api.json` 都已核对,两者都不含任何一个 qwen4 id —— 于是整个代际落到了 256K 的家族兜底上。这与那个 PR 为邀测系列修复的症状相同:自动压缩在真实窗口约 22% 处就触发,而且没有任何显式报错足以暴露它。

在 `main` 的 `79a9b753c60` 上实测,改动之前:`qwen4`、`qwen4-max`、`qwen4-plus`、`qwen4.5-max`、`qwen4-coder-plus`、`qwen4-max-2026-10-01`、`openai/qwen4-max` 与 `qwen4-omni-120b-think` 全部解析为 262,144。其中最后一个已经在 omni 夹具中作为会话模型使用,所以这些 id 并非假想。

这也遵循该表对其他家族新代际已采用的前向默认约定(Gemini 3.x、GLM-5.2+、Kimi K3):按代际钉一次,而不是按每个次版本钉。

## 评审验证计划

### 如何验证

把一个 OpenAI 兼容 provider 指向任意 qwen4 id(例如 `qwen4-max`),然后执行 `/context`。头部应显示 `Context window: 1000.0k tokens`;改动之前同一 id 显示的是 `Context window: 262.1k tokens`。识别逻辑只在 API key 类认证路径上才会被走到 —— Qwen OAuth 仅准入 `coder-model`,并在计算任何窗口之前就完成替换,因此该认证类型无论改动前后都不受影响。

单测层面,在 `packages/core` 目录下执行:

```
npx vitest run src/core/tokenLimits.test.ts
```

两条新用例都逐一做过变异验证,每次只改一处,确认它们不是空跑通过:

- 把新规则从 1M 改为 256K:`should return 1M for the qwen4 generation` 失败,106 项中其余 105 项仍通过。
- 跳过目录分支、让家族表先作答:`should let a qwen4 catalog entry outrank the family row` 在 400,000 这个目录值上失败。

周边套件也一并跑过 —— `tokenLimits`、`modalityDefaults`、`model-catalog`、`model-catalog-refresh`、`modelConfigResolver` —— 316 项通过,另外还跑了携带 `qwen4-omni-120b-think` 夹具的三个 omni 套件(90 项通过)。两个改动文件的 `prettier --check` 与 `eslint` 均干净,core 包的 `tsc --noEmit` 也干净。全仓 `npm run typecheck` 在本检出中停在 `integrations/generated-ui`,原因是缺少 `@jitl/quickjs-singlefile-browser-release-sync` 模块,与这两个文件无关。

此外还用仓库自带的 `integration-tests/fake-openai-server.ts` 端到端驱动了产品真实的 `/context` 路径,因此不需要 qwen4 凭据:

```
qwen -p '/context' --auth-type openai --model qwen4-max \
  --openai-base-url <fake>/v1 --openai-api-key fake-key
```

两臂都使用临时 `QWEN_HOME` 与 `QWEN_CODE_MODELS_DEV_REFRESH=off`,并通过 `npm run dev` 的入口(`scripts/dev.js`)直接跑 TypeScript 源码。两臂之间唯一的差别是工作树中新规则的取值(head 为 1M,base 为 256K,跑完即还原),没有重新构建或改动其他配置。

### 证据(改动前后)

采集自真实的 headless `/context` 输出,两臂使用同一条命令与同一个模型 id,退出码均为 0:

```
base: Model: qwen4-max  Context window: 262.1k tokens
head: Model: qwen4-max  Context window: 1000.0k tokens
```

百分比列也随窗口相应变化 —— 同样 25.2k 的 memory 文件在 base 上显示 `9.6%`,在 head 上显示 `2.5%`。作为同一路径上的非回归核对,改动生效后 `qwen3-max` 仍显示 `Context window: 262.1k tokens`。

|  | 改动前 | 改动后 |
| --- | --- | --- |
| 识别出的上下文窗口 | 262,144 | 1,000,000 |
| `/context` 头部(实采) | `262.1k tokens` | `1000.0k tokens` |
| 自动压缩阈值 | ≈222,822 | 850,000 |
| 硬阈值 | 239,144 | 977,000 |

两行阈值是在源码层面由窗口值推算的,而非从终端读出,因为首次 API 响应之前的 `/context` 只打印窗口与开销明细。它们遵循 `computeThresholds` 的阈值梯:auto 为 `min(0.85 × window, window − 20k − 13k)`,hard 为 `window − 20k − 3k`。

### 测试环境

| 操作系统 | 状态 |
| --- | --- |
| 🍏 macOS | ✅ |
| 🪟 Windows | ⚠️ |
| 🐧 Linux | ⚠️ |

### 运行环境(可选)

单元测试,加上通过 `npm run dev` 直接跑 TypeScript 源码的 headless CLI(Node 22.22.2),对接仓库自带的 fake OpenAI server,运行于 macOS 26.5.1 / arm64。未调用任何真实 qwen4 端点。

## 风险与范围

- 主要风险或权衡:这条规则把整个 qwen4 代际都当作 1M,这一点来自评审者的说明,而非当前代码或 models.dev 所能确认。若该代际某个成员的窗口更小,主动压缩门仍按推断出的 1M 运行,因此压缩触发过晚,请求会因长度被拒。这种情况可恢复,但代价至少是一次失败请求:该拒绝会把服务端自己报出的上限带进反应式压缩,后者据此为摘要与重试定尺寸,而不是把超限历史重新投给刚刚拒绝它的端点。目录条目一旦发布即覆盖这条规则,也就消除了这份推测。
- 该代际中最不确定的成员:`qwen4-omni-120b-think` 是目前唯一已在 omni 夹具中作为会话模型使用的 qwen4 id,它是多模态模型,这条规
feelspeaceman900134

Interpretation history

Decision trace