{
  "@context": "https://schema.org",
  "@id": "https://aggr.aymericbeaumet.com/items/qwen-ai/2026-08-26-qwen3-8-flash-next-a-new-architecture-towards-ultimate-cost/#webpage",
  "@type": [
    "WebPage",
    "ArchiveComponent"
  ],
  "articleBody": "![Qwen3.8-Flash-Next](https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.8-Flash-Next/Qwen3.8-flash_banner_en.jpg#center)\n\n[HUGGING FACE](https://huggingface.co/Qwen/Qwen3.8-Flash-Next) [MODELSCOPE](https://modelscope.cn/models/Qwen/Qwen3.8-Flash-Next) [TECH REPORT](https://github.com/QwenLM/Qwen3.8-Flash-Next/blob/main/tech_report.pdf) [FLASHQLA](https://github.com/QwenLM/FlashQLA) [DISCORD](https://discord.gg/yPEP2vHTu4)\n\n## Introduction\n\nIn this release we are opening the weights of **Qwen3.8-Flash-Next**, a multimodal MoE model that also serves as an early preview of the architecture used in **Qwen4**. It plays the same role that [Qwen3-Next](https://qwen.ai/blog?id=qwen3-next) played for Qwen3.5: the hybrid **Gated DeltaNet + Gated Attention** design introduced at that time has since been used across the Qwen3.5, Qwen3.6, Qwen3.7 and Qwen3.8 series. We are again releasing the architectural changes early, so that the community can examine them before the full Qwen4 model family is built on top of them.\n\nQwen3.8-Flash-Next upgrades the model systematically along four aspects — **attention, residual, embedding and optimization** — improving model capability while further optimizing computational efficiency, model capacity and training stability:\n\n- **Attention**: A **GDN + QSA hybrid architecture**. Gated DeltaNet (GDN) compresses the history efficiently; **Qwen Sparse Attention (QSA)** uses a compressed lightweight indexer to select the important context at micro-block granularity, substantially reducing the cost of attention on long sequences.\n- **Residual**: **Gated Residual (GR)** widens the residual stream into 4 branches and controls reads and writes with a dynamic gate, strengthening cross-layer information flow and training stability.\n- **Embedding**: **N-gram Embedding** looks up a table using the local context to scale model capacity with very little extra computation; the embedding table can be offloaded to host memory and overlapped with model computation through asynchronous prefetching.\n- **Optimization**: The **Muon optimizer** is used, refined around orthogonalization accuracy, the division of labour between Muon and AdamW, and the splitting of fused parameters, with the scaling law refitted for the new architecture.\n\nQwen3.8-Flash-Next features a **125B**-parameter main model, supplemented by an additional **51B** N-gram embeddings, with **6B** parameters activated per token. Compared with Qwen3.7-Plus, Qwen3.8-Flash-Next substantially reduces both training and inference cost — training takes only about 1/9 as much, yet it delivers superior capabilities in coding and office tasks.\n\nIt natively supports **262,144** tokens of context and is extensible to **1,000,000** tokens with YaRN. For more technical details on the architecture, training methodology, and experimental analysis of Qwen3.8-Flash-Next, please refer to the [technical report](https://github.com/QwenLM/Qwen3.8-Flash-Next/blob/main/tech_report.pdf) in our GitHub repository.\n\nQwen3.8-Flash-Next weights are now available on [Hugging Face](https://huggingface.co/Qwen/Qwen3.8-Flash-Next) and [ModelScope](https://modelscope.cn/models/Qwen/Qwen3.8-Flash-Next). The production version, with 1M context by default and official built-in tools, is served as **Qwen3.8-Flash** on [QwenCloud](https://www.qwencloud.com/models/qwen3.8-flash), **priced at 0.15 USD per million input tokens and 0.47 USD per million output tokens**.\n\n## Performance\n\n### Language\n\n|                                                           | Qwen3.8-Flash-Next            | Qwen3.8-27B               | Qwen3.7-Plus              | DeepSeek-V4-Flash-0731      | Claude-Opus-4.6 (Max) |\n| --------------------------------------------------------- | ----------------------------- | ------------------------- | ------------------------- | --------------------------- | --------------------- |\n| \\# Params                                                 | 125B                          | 27B                       | 397B                      | 284B                        | --                    |\n| \\# Activated params                                       | 6B                            | 27B                       | 17B                       | 13B                         | --                    |\n| \\# N-gram embedding params                                | 51B                           | --                        | --                        | --                          | --                    |\n| Coding                                                    |                               |                           |                           |                             |                       |\n| Agentic coding  DeepSWE 1.1                               | **58.7**                      | 42.2                      | 16.5                      | 54.4                        | --                    |\n| Agentic coding  SWE-bench Pro                             | **62.5**                      | 61.7                      | 55.8                      | 56.0                        | 53.4                  |\n| Multilingual software engineering  SWE-bench Multilingual | **81.0**                      | 73.8                      | 75.8                      | --                          | 77.5                  |\n| Repo-level code generation  NL2Repo-Bench                 | 48.1                          | 42.3                      | 41.1                      | **54.2**                    | 47.6                  |\n| Agent                                                     |                               |                           |                           |                             |                       |\n| Long-horizon office work  CoWorkBench                     | **73.9**                      | 70.7                      | 65.1                      | 45.1                        | 68.2                  |\n| Professional job tasks  JobBench                          | **55.7**                      | 33.4                      | 27.6                      | 41.3                        | 36.6                  |\n| Frontier agentic tasks  Agents' Last Exam                 | Pass@1  24.3  Score  **51.2** | Pass@1  20.4  Score  42.9 | Pass@1  13.2  Score  33.6 | Pass@1  **25.2**  Score  -- | --                    |\n| Real-world tool use  Toolathlon Verified (Pass@1)         | **73.5**                      | 67.1                      | 50.6                      | 70.3                        | --                    |\n| General                                                   |                               |                           |                           |                             |                       |\n| Instruction following  IFBench                            | **81.3**                      | 79.5                      | 79.1                      | 79.2                        | 62.5                  |\n| Scientific reasoning  GPQA Diamond                        | **91.7**                      | 89.2                      | 90.3                      | 90.8                        | 91.3                  |\n| Multidisciplinary reasoning  HLE                          | 35.9                          | 30.8                      | 34.7                      | 33.8                        | **40.0**              |\n| Competitive coding  LiveCodeBench v6                      | **91.9**                      | 90.3                      | 89.6                      | 90.6                        | 88.8                  |\n\n1\\. DeepSWE 1.1: evaluated with the Claude Code and mini-SWE-agent harnesses, temp=1.0, top\\_p=0.95, 256K context window. We report the highest score across the two harnesses; notably, Qwen3.8-Flash-Next performs best on mini-SWE-agent.\\\n2\\. SWE-bench Pro: except for Claude-Opus-4.6 (Max), for which we report the officially published score, all models are evaluated with the Claude Code harness, temp=1.0, top\\_p=0.95, 256K context window. Problematic tasks were corrected and all baseline models were re-evaluated on the refined benchmark.\\\n3\\. SWE-bench Multilingual: evaluated with the mini-SWE-agent harness, temp=1.0, top\\_p=0.95, 256K context window.\\\n4\\. NL2Repo-Bench: evaluated with the Claude Code harness. To prevent reward hacking, we disable Bash commands that attempt to access the specific repository, such as pip download, pip install and git clone.\\\n5\\. CoWorkBench: an in-house cowork benchmark for evaluating long-horizon office and productivity agent tasks across computer science, finance, law, medical and other productivity domains.\\\n6\\. HLE: judged by GPT-4o.\\\n7\\. The best result in each row is shown in bold.\\\n8\\. Empty cells (--): scores are not yet available or are not applicable.\n\n### Vision Language\n\n|                                         | Qwen3.8-Flash-Next                      | Qwen3.8-27B                     | Qwen3.7-Plus                        | Claude-Opus-4.6 (Max)       |\n| --------------------------------------- | --------------------------------------- | ------------------------------- | ----------------------------------- | --------------------------- |\n| Agentic Multimodal Intelligence         |                                         |                                 |                                     |                             |\n| Multimodal tool use  ClawEval-MM        | Pass@3  **64.4**  Average  **60.4**     | Pass@3  57.4  Average  56.9     | Pass@3  57.4  Average  60.1         | Pass@3  52.5  Average  54.7 |\n| Application recreation  RecreationBench | **49.9**                                | 47.1                            | 30.2                                | --                          |\n| Mobile use  AndroidWorld                | **84.5**                                | 81.9                            | 81.0                                | 62.0                        |\n| Computer use  OSWorld 2.0               | Binary  **19.4**  Partial  **52.3**     | Binary  19.4  Partial  48.0     | Binary  2.8  Partial  21.5          | --                          |\n| Visual web development  Vision2Web      | **64.0**                                | 62.9                            | 42.1                                | --                          |\n| General Multimodal Intelligence         |                                         |                                 |                                     |                             |\n| Embodied intelligence  ERQA             | **72.3**                                | 65.5                            | 69.8                                | 40.8                        |\n| Long video understanding  LVBench       | **76.6**                                | 72.4                            | 76.2                                | 63.0                        |\n| Real-world perception  RealWorldQA      | **88.5**                                | 85.9                            | 86.9                                | 73.9                        |\n| Visual math problem solving  MathVision | Without CI  **90.6**  With CI  **95.7** | Without CI  90.0  With CI  94.6 | Without CI  90.3  With CI  88.7     | Without CI  65.5            |\n| Scientific chart analysis  CharXiv (RQ) | Without CI  84.6  With CI  **90.6**     | Without CI  83.7  With CI  90.2 | Without CI  **85.8**  With CI  85.9 | Without CI  66.0            |\n\n1\\. ClawEval-MM: scores are reported as \"pass@3 / average score\". Pass@3 measures the percentage passed in at least one of three trials, and the average score is the mean score across the three trials.\\\n2\\. RecreationBench: an in-house long-horizon application-recreation benchmark for evaluating hybrid-agent abilities spanning five platforms — desktop (Ubuntu, macOS, Windows), mobile (Android) and web.\\\n3\\. OSWorld 2.0: scores are reported as \"binary / partial\". The binary score is the percentage of tasks that receive the full task reward, while the partial score aggregates the partial rewards obtained across all tasks.\\\n4\\. Vision2Web: scores are reported as the average over the frontend, webpage and website categories, using the Claude Code harness and judged by gpt-5.4-2026-03-05.\\\n5\\. MathVision, CharXiv (RQ): scores are reported as \"without CI / with CI\". A small number of incorrect ground-truth annotations in MathVision were corrected after manual verification. Our model's score is evaluated using a fixed prompt, e.g. \"Please reason step by step, and put your final answer within \\\\boxed{}.\" For other models, we report the higher score between runs with and without the \\\\boxed{} formatting.\\\n6\\. The best result in each row is shown in bold.\\\n7\\. Empty cells (--) indicate scores not yet available or not applicable.\n\n## Model Architecture\n\n![Qwen3.8-Flash-Next architecture](https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.8-Flash-Next/architecture.png#center)\n\n### Attention: GDN + QSA for Efficient Memory and Precise Retrieval\n\nTraditional Full Attention provides direct access to all previous tokens, but as the context grows longer, both computation and KV Cache memory-access costs increase substantially.\n\nFollowing the architecture design introduced in Qwen3.5, Qwen3.8-Flash-Next adopts a **GDN [\\[1\\]](https://qwen.ai/blog/qwen3.8-flash-next/#ref1) + Attention Hybrid architecture**: three out of every four layers use Gated DeltaNet (GDN) to continuously compress historical information into a fixed-size state, while the remaining layer uses global Attention for precise retrieval of information across the full context.\n\nFor global Attention, we further introduce **Qwen Sparse Attention (QSA)**. Sparse Attention reduces long-sequence computation by attending only to important context. However, existing approaches such as DSA [\\[2\\]](https://qwen.ai/blog/qwen3.8-flash-next/#ref2) still rely on a token-level indexer to identify important positions; as the context grows, the indexer itself becomes a non-negligible source of computation.\n\nQSA further compresses this process: a lightweight indexer first aggregates the sequence into **micro-blocks**, estimates context importance at the block level, and then selects the most relevant regions for Attention. This reduces not only the cost of Attention itself, but also the indexing overhead required to identify important context. Compared with approaches that share indices across layers [\\[3\\]](https://qwen.ai/blog/qwen3.8-flash-next/#ref3), QSA performs sequence compression independently within each layer, reducing its dependence on cross-layer Attention similarity and making it particularly well suited to Hybrid architectures where GDN and Attention layers are interleaved.\n\n![Overview of Qwen Sparse Attention (QSA)](https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.8-Flash-Next/qsa_arch.png#center)\n\nPut simply: **GDN efficiently “remembers,” while QSA precisely “retrieves.”**\n\nAt **1M tokens**, QSA’s Attention Kernel achieves up to **7.6×** and **4.9×** speedups in Prefill and Decode, respectively. In an experimental setup representative of online serving scenarios with high cache reuse (a **90% Prefix Cache hit rate**), Qwen3.8-Flash-Next achieves **8.6×** the Prefill throughput of Qwen3.7-Plus at a **1M-token context length**.\n\n![Relative prefill throughput at 90% cache hit rate](https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.8-Flash-Next/throughput.png#center)\n\n### Gated Residual: More Paths for Information Flow\n\nIn a traditional Transformer, all layers continuously read from and write to the same Residual Stream. As the network becomes deeper, early features are repeatedly mixed with later information, making important signals more likely to be gradually diluted.\n\n**Gated Residual (GR)** can be viewed as a combination of two ideas: it follows **Hyper-Connection** [\\[4\\]](https://qwen.ai/blog/qwen3.8-flash-next/#ref4) in widening the residual stream into multiple branches, while incorporating the element-wise dynamic gating of **GatedNorm** [\\[5\\]](https://qwen.ai/blog/qwen3.8-flash-next/#ref5) into the residual read. The original single residual stream is expanded into four parallel branches, allowing the model to dynamically determine how much information to read from each branch and how much to write back to each branch based on the current content.\n\nThis can be conceptualized as expanding a single information channel into multiple parallel pathways: some branches handle local information flow, while others preserve early information directly deep into the network layers. Empirical analysis also reveals that one of these branches naturally emerges as a long-range pathway connecting the first Attention layer to most of the middle and subsequent layers.\n\nGR also further simplifies Hyper-Connection. Once the read and write operations are expressive enough, additional branch mixing yields no significant benefits and can thus be directly removed, thereby reducing memory access overhead and sources of instability. The Gate also effectively suppresses **activation outliers** and improves training stability. In addition, the Residual State supports **FP8** storage, further reducing memory-access overhead.\n\n### N-gram Embedding: Expanding Model Capacity at Low Cost\n\nInspired by Per-Layer Embedding in Gemma 3n and works such as DeepSeek Engram [\\[6\\]](https://qwen.ai/blog/qwen3.8-flash-next/#ref6), we further introduce **N-gram Embedding** to scale model capacity beyond the parameters of the Transformer backbone.\n\nA standard Embedding performs a lookup based on a single token. N-gram Embedding instead performs lookups using the local context formed by the current token and several preceding tokens, providing additional representations for common phrases and local patterns.\n\nIts key advantage is that it **can add a large number of parameters with almost no additional computation per token**.\n\nQwen3.8-Flash-Next introduces an additional **51B N-gram Embedding parameters**. Because lookup locations can be determined in advance, these parameters can be stored in Host Memory and asynchronously prefetched in parallel with model computation, without permanently occupying GPU memory.\n\nThe final model uses only a single N-gram Embedding layer near the beginning of the network, effectively adding a large-scale **“local-pattern memory”** at relatively low additional cost.\n\n### Optimization: Co-designing Architecture and Optimization\n\nQwen3.8-Flash-Next is trained with the **Muon Optimizer** [\\[7\\]](https://qwen.ai/blog/qwen3.8-flash-next/#ref7), with further improvements around three key aspects of applying Muon to large-scale model training: **orthogonalization accuracy, parameter assignment between Muon and AdamW, and splitting fused parameter matrices**.\n\nFor parameters that genuinely act as two-dimensional linear maps, such as the main weights in Attention, GDN, and MoE Experts, we use Muon. Embeddings, the MoE Router, and the low-rank parameters in GR continue to use AdamW. For QKV, SwiGLU, and GDN projections that are fused in the implementation, we first split them according to the independent linear transformations they represent, and then perform orthogonalization separately.\n\nFor the new architecture and Optimizer, we refit the Scaling Law. The results show that the model can stably use **larger Learning Rates and Batch Sizes**, further improving convergence efficiency and large-scale parallel training throughput.\n\nWe also find that **Batch Size Warmup**, a common practice in large-scale model training, is no longer necessary: gradually increasing from a small Batch to the target Batch does not improve the final result, but instead requires **18.8% more optimizer steps**. In the final training Recipe, we therefore start directly with the target Batch Size.\n\n### Other Architecture Optimizations\n\nThe remaining components follow the design established in Qwen3-Next and refined through the Qwen3.5–Qwen3.8 series.\n\n- **Ultra-sparse MoE**: With global load balancing [\\[8\\]](https://qwen.ai/blog/qwen3.8-flash-next/#ref8), increasing total expert parameters while keeping the number of activated experts fixed steadily reduces training loss. Qwen3.8-Flash-Next therefore uses a large expert pool with a small number of routed experts per token, together with one shared expert.\n- **Multi-Token Prediction**: The MTP module is trained with multiple steps, maintaining consistency between training and inference and thereby improving the acceptance rate of speculative decoding in real scenarios, while also enhancing the performance of the backbone. Its full-attention layers are replaced with QSA as well.\n- **Training stability**: Zero-centered RMSNorm with weight decay applied to norm weights, the attention output gating mechanism [\\[9\\]](https://qwen.ai/blog/qwen3.8-flash-next/#ref9), and normalized MoE router initialization are retained. These designs make small-scale ablations more reliable and help large-scale training run smoothly.\n\n## Base Model Performance\n\nWe compare Qwen3.8-Flash-Next-Base with the base models of Qwen3.8-27B and Qwen3.7-Plus.\n\n|                            | Qwen3.8-Flash-Next-Base | Qwen3.8-27B-Base | Qwen3.7-Plus-Base |\n| -------------------------- | ----------------------- | ---------------- | ----------------- |\n| \\# Params                  | 125B                    | 27B              | 397B              |\n| \\# Activated params        | 6B                      | 27B              | 17B               |\n| \\# N-gram embedding params | 51B                     | --               | --                |\n| General tasks              |                         |                  |                   |\n| MMLU                       | 90.36                   | 87.51            | **90.43**         |\n| MMLU-Redux                 | 90.68                   | 87.26            | **91.47**         |\n| MMLU-Pro                   | **73.23**               | 68.60            | 70.90             |\n| SuperGPQA                  | **51.36**               | 44.86            | 48.42             |\n| BBH                        | **90.87**               | 89.56            | 89.41             |\n| Math & STEM tasks          |                         |                  |                   |\n| GPQA                       | 51.42                   | 45.01            | **51.52**         |\n| GSM8K                      | **93.29**               | 93.18            | 92.95             |\n| MATH                       | 72.78                   | 60.54            | **74.38**         |\n| Coding tasks               |                         |                  |                   |\n| EvalPlus                   | **78.76**               | 76.05            | 78.06             |\n| MultiPL-E                  | 79.09                   | 74.50            | **81.68**         |\n| SWEBench-Pretrain          | **50.99**               | 41.66            | 49.24             |\n| Multilingual tasks         |                         |                  |                   |\n| MGSM                       | **89.33**               | 86.37            | 85.42             |\n| MMMLU                      | **84.86**               | 79.74            | 84.53             |\n| INCLUDE                    | 78.40                   | 74.37            | **78.90**         |\n\n1\\. The best result in each row is shown in bold.\\\n2\\. Empty cells (--): scores are not yet available or not applicable.\n\nWith 6B activated parameters, Qwen3.8-Flash-Next-Base achieves the best result on 8 of the 14 benchmarks, including MMLU-Pro, SuperGPQA, BBH, GSM8K, EvalPlus, SWEBench-Pretrain, MGSM and MMMLU, and remains close to Qwen3.7-Plus-Base on MMLU, MMLU-Redux, GPQA, MATH and MultiPL-E. The 51B N-gram embedding parameters are deterministically addressed and do not enter the per-token matrix-multiplication budget.\n\n## Develop with Qwen3.8-Flash-Next\n\nQwen3.8-Flash-Next is available as an open-weight model on [HuggingFace](https://huggingface.co/collections/Qwen/qwen38-flash-next) and [ModelScope](https://www.modelscope.cn/collections/Qwen/Qwen38-Flash-Next), with official managed APIs on [QwenCloud](https://www.qwencloud.com/models/qwen3.8-flash). Designed to balance capability, latency, and cost, it is well suited for high-volume applications, tool-driven workflows, and coding & coworking assistants. In the following, you can explore how to call the QwenCloud API and integrate Qwen3.8-Flash-Next into agentic systems and coding assistants.\n\n### API Usage\n\nQwen3.8-Flash-Next is available via API:\n\n#### QwenCloud\n\nOn [QwenCloud](https://www.qwencloud.com), the model is served under the name [`qwen3.8-flash`](https://www.qwencloud.com/models/qwen3.8-flash). QwenCloud supports industry-standard protocols, including OpenAI-compatible Chat Completions and Responses APIs, alongside an Anthropic-compatible interface.\n\n```python\n\"\"\"\nEnvironment variables:\n  DASHSCOPE_API_KEY: Your API Key from https://home.qwencloud.com/\n  DASHSCOPE_BASE_URL: (optional) Base URL for compatible-mode API.\n    - Beijing: https://dashscope.aliyuncs.com/compatible-mode/v1\n    - Singapore: https://dashscope-intl.aliyuncs.com/compatible-mode/v1\n    - US (Virginia): https://dashscope-us.aliyuncs.com/compatible-mode/v1\n\"\"\"\nfrom openai import OpenAI\nimport os\n\napi_key = os.environ.get(\"DASHSCOPE_API_KEY\")\nif not api_key:\n    raise ValueError(\n        \"DASHSCOPE_API_KEY is required. \"\n        \"Set it via: export DASHSCOPE_API_KEY='your-api-key'\"\n    )\n\nclient = OpenAI(\n    api_key=api_key,\n    base_url=os.environ.get(\n        \"DASHSCOPE_BASE_URL\",\n        \"https://dashscope-intl.aliyuncs.com/compatible-mode/v1\",\n    ),\n)\n\nmessages = [{\"role\": \"user\", \"content\": \"Write a Python function to merge two sorted linked lists.\"}]\n\ncompletion = client.chat.completions.create(\n    model=\"qwen3.8-flash\",\n    messages=messages,\n    extra_body={\n        \"enable_thinking\": True,\n        # \"preserve_thinking\": True,\n    },\n    reasoning_effort=\"xhigh\",  # supported levels are xhigh, medium, and low\n    stream=True,\n)\n\nreasoning_content = \"\"\nanswer_content = \"\"\nis_answering = False\nprint(\"\\n\" + \"=\" * 20 + \"Reasoning\" + \"=\" * 20 + \"\\n\")\n\nfor chunk in completion:\n    if not chunk.choices:\n        print(\"\\nUsage:\")\n        print(chunk.usage)\n        continue\n\n    delta = chunk.choices[0].delta\n\n    if hasattr(delta, \"reasoning_content\") and delta.reasoning_content is not None:\n        if not is_answering:\n            print(delta.reasoning_content, end=\"\", flush=True)\n        reasoning_content += delta.reasoning_content\n\n    if hasattr(delta, \"content\") and delta.content:\n        if not is_answering:\n            print(\"\\n\" + \"=\" * 20 + \"Answer\" + \"=\" * 20 + \"\\n\")\n            is_answering = True\n        print(delta.content, end=\"\", flush=True)\n        answer_content += delta.content\n```\n\n### Agent Frameworks & Coding Assistants\n\nQwen3.8-Flash-Next integrates seamlessly with popular agent frameworks and coding assistants:\n\n#### QwenWork\n\n[QwenWork](https://qwenwork.ai) is Alibaba’s flagship AI productivity platform, designed to help individuals and enterprises automate daily tasks and accelerate operational efficiency.\n\nWe are excited to share that QwenWork has integrated **Qwen3.8-Flash-Next** to power its newly launched “Standard” mode, leveraging the model’s cutting-edge capabilities to deliver a seamless, cost-effective experience that sets a new standard for AI agents in the workplace.\n\n![Qwen3.8-Flash on QwenWork](https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.8-Flash-Next/qwen-work-ai.png#center)\n\nLearn more in the [official documentation](https://docs.qwenwork.ai/product-introduction)!\n\n#### Claude Code\n\nQwen APIs support the Anthropic API protocol, enabling direct use with **Claude Code**:\n\n```bash\nnpm install -g @anthropic-ai/claude-code\n\nexport ANTHROPIC_MODEL=\"qwen3.8-flash\"\nexport ANTHROPIC_SMALL_FAST_MODEL=\"qwen3.8-flash\"\nexport ANTHROPIC_BASE_URL=https://dashscope-intl.aliyuncs.com/apps/anthropic\nexport ANTHROPIC_AUTH_TOKEN=<your_api_key>\n\nclaude\n```\n\n#### Codex\n\nQwen APIs support the OpenAI Responses protocol, enabling use with **Codex**:\n\nIn `~/.codex/model-catalog.local.json`\n\n```json\n{\n  \"models\": [\n    {\n      \"slug\": \"qwen3.8-flash\",\n      \"display_name\": \"qwen3.8-flash\",\n      \"description\": \"QwenCloud: Qwen3.8-Flash\",\n      \"default_reasoning_level\": \"xhigh\",\n      \"supported_reasoning_levels\": [\n        {\n          \"effort\": \"low\",\n          \"description\": \"Fast responses with lighter reasoning\"\n        },\n        {\n          \"effort\": \"medium\",\n          \"description\": \"Greater reasoning depth for complex problems\"\n        },\n        {\n          \"effort\": \"xhigh\",\n          \"description\": \"Extra high reasoning depth for complex problems\"\n        }\n      ],\n      \"context_window\": 1000000,\n      \"effective_context_window_percent\": 95,\n      \"supports_parallel_tool_calls\": true,\n      \"supports_image_detail_original\": true,\n      \"input_modalities\": [\"text\", \"image\"],\n      \"shell_type\": \"default\",\n      \"visibility\": \"list\",\n      \"supported_in_api\": true,\n      \"priority\": 1,\n      \"base_instructions\": \"\",\n      \"support_verbosity\": false,\n      \"supports_reasoning_summaries\": false,\n      \"experimental_supported_tools\": [],\n      \"truncation_policy\": {\n        \"mode\": \"bytes\",\n        \"limit\": 10000\n      }\n    }\n  ]\n}\n```\n\nIn `~/.codex/config.toml`\n\n```toml\nmodel_catalog_json = \"~/.codex/model-catalog.local.json\"\n\nmodel_provider = \"QwenCloud\"\nmodel = \"qwen3.8-flash\"\n\n[model_providers.QwenCloud]\nname = \"QwenCloud\"\nbase_url = \"https://dashscope-intl.aliyuncs.com/compatible-mode/v1\"\nenv_key = \"OPENAI_API_KEY\"\nwire_api = \"responses\"\n```\n\n```bash\nnpm install -g @openai/codex\n\nexport OPENAI_API_KEY=<your_api_key>\n\ncodex\n```\n\n#### Qoder CLI\n\n[Qoder](https://qoder.com/) co-evolves with Qwen for agentic coding:\n\n```bash\ncurl -fsSL https://qoder.com/install | bash\n\nqoder\n```\n\n#### Qwen Code\n\n[Qwen Code](https://qwen.ai/qwencode) is deeply optimized for the Qwen series:\n\n```bash\nnpm install -g @qwen-code/qwen-code@latest\n\nqwen\n```\n\n#### OpenClaw\n\nConnect to [OpenClaw](https://openclaw.ai) via [QwenCloud](https://docs.qwencloud.com/developer-guides/clients-and-developer-tools/openclaw):\n\n```bash\ncurl -fsSL https://openclaw.ai/install.sh | bash\n\nexport DASHSCOPE_API_KEY=<your_api_key>\n\nopenclaw dashboard\n```\n\nConfigure `~/.openclaw/openclaw.json`:\n\n```json\n{\n  \"models\": {\n    \"mode\": \"merge\",\n    \"providers\": {\n      \"qwencloud\": {\n        \"baseUrl\": \"https://dashscope-intl.aliyuncs.com/compatible-mode/v1\",\n        \"apiKey\": \"DASHSCOPE_API_KEY\",\n        \"api\": \"openai-completions\",\n        \"models\": [\n          {\n            \"id\": \"qwen3.8-flash\",\n            \"name\": \"qwen3.8-flash\",\n            \"reasoning\": true,\n            \"input\": [\"text\", \"image\"],\n            \"contextWindow\": 1000000,\n            \"maxTokens\": 65536\n          }\n        ]\n      }\n    }\n  },\n  \"agents\": {\n    \"defaults\": {\n      \"model\": {\n        \"primary\": \"qwencloud/qwen3.8-flash\"\n      }\n    }\n  }\n}\n```\n\n## Summary\n\nQwen3.8-Flash-Next extends the hybrid architecture introduced in Qwen3-Next along four directions: attention, residual, embedding and optimization. QSA compresses the sequence into micro-blocks within each layer, reducing both the attention cost and the indexing cost at long context while keeping precise retrieval. Gated Residual widens the residual stream into several parallel branches and controls reads and writes with an elementwise, data-dependent gate, improving cross-layer information flow and training stability at negligible arithmetic cost; the residual state can additionally be kept in FP8, which further reduces memory traffic. N-gram embedding scales capacity through deterministically addressed lookup memory, which can be scaled with negligible per-token computation and offloaded to host memory. On the optimization side, Muon is used as the main optimizer, with orthogonalization accuracy, parameter assignment and fused-matrix splitting as the decisive implementation choices, and the scaling law refitted for the new architecture.\n\nWe release these weights early so that the architecture can be evaluated independently by the community, as we did with Qwen3-Next, and we will continue to refine it towards Qwen4.\n\n## Citation\n\n```bibtex\n@techreport{qwen2026design,\n    title       = {On the Design of {Qwen3.8-Next} Architecture: Evaluation, Efficiency, and Training Stability},\n    author      = {{Qwen Team}},\n    institution = {Alibaba Group},\n    month       = {August},\n    year        = {2026}\n}\n\n@misc{qwen3.8flashnext,\n    title  = {{Qwen3.8-Flash-Next}: A New Architecture, Towards Ultimate Cost-Efficiency},\n    author = {{Qwen Team}},\n    month  = {August},\n    year   = {2026},\n    url    = {https://qwen.ai/blog?id=qwen3.8-flash-next}\n}\n```\n\n# References\n\n\\[1\\] Gated Delta Networks: Improving Mamba2 with Delta Rule\n\n\\[2\\] DeepSeek-V3.2: Pushing the Frontier of Open Large Language Models\n\n\\[3\\] IndexCache: Accelerating Sparse Attention via Cross-Layer Index Reuse\n\n\\[4\\] Hyper-Connections\n\n\\[5\\] A Unified View of Attention and Residual Sinks: Outlier-Driven Rescaling is Essential for Transformer Training\n\n\\[6\\] Conditional Memory via Scalable Lookup: A New Axis of Sparsity for Large Language Models\n\n\\[7\\] Muon: An Optimizer for Hidden Layers in Neural Networks\n\n\\[8\\] Demons in the Detail: On Implementing Load Balancing Loss for Training Specialized Mixture-of-Expert Models\n\n\\[9\\] Gated Attention for Large Language Models: Non-linearity, Sparsity, and Attention-Sink-Free\n",
  "authors": [
    "QwenTeam"
  ],
  "captured_at": "2026-10-19T01:26:53.998049939+00:00",
  "category": "ai",
  "content_html": "<p><picture class=\"article-picture article-picture-fallback\" style=\"--image-ratio:16 / 9\"><img src=\"https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.8-Flash-Next/Qwen3.8-flash_banner_en.jpg#center\" alt=\"Qwen3.8-Flash-Next\" loading=\"eager\" decoding=\"async\" fetchpriority=\"high\" referrerpolicy=\"no-referrer\" class=\"progressive-image\"></picture></p>\n<p><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/Qwen/Qwen3.8-Flash-Next\">HUGGING FACE</a> <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://modelscope.cn/models/Qwen/Qwen3.8-Flash-Next\">MODELSCOPE</a> <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://github.com/QwenLM/Qwen3.8-Flash-Next/blob/main/tech_report.pdf\">TECH REPORT</a> <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://github.com/QwenLM/FlashQLA\">FLASHQLA</a> <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://discord.gg/yPEP2vHTu4\">DISCORD</a></p>\n<h2>Introduction</h2>\n<p>In this release we are opening the weights of <strong>Qwen3.8-Flash-Next</strong>, a multimodal MoE model that also serves as an early preview of the architecture used in <strong>Qwen4</strong>. It plays the same role that <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://qwen.ai/blog?id=qwen3-next\">Qwen3-Next</a> played for Qwen3.5: the hybrid <strong>Gated DeltaNet + Gated Attention</strong> design introduced at that time has since been used across the Qwen3.5, Qwen3.6, Qwen3.7 and Qwen3.8 series. We are again releasing the architectural changes early, so that the community can examine them before the full Qwen4 model family is built on top of them.</p>\n<p>Qwen3.8-Flash-Next upgrades the model systematically along four aspects — <strong>attention, residual, embedding and optimization</strong> — improving model capability while further optimizing computational efficiency, model capacity and training stability:</p>\n<ul>\n<li><strong>Attention</strong>: A <strong>GDN + QSA hybrid architecture</strong>. Gated DeltaNet (GDN) compresses the history efficiently; <strong>Qwen Sparse Attention (QSA)</strong> uses a compressed lightweight indexer to select the important context at micro-block granularity, substantially reducing the cost of attention on long sequences.</li>\n<li><strong>Residual</strong>: <strong>Gated Residual (GR)</strong> widens the residual stream into 4 branches and controls reads and writes with a dynamic gate, strengthening cross-layer information flow and training stability.</li>\n<li><strong>Embedding</strong>: <strong>N-gram Embedding</strong> looks up a table using the local context to scale model capacity with very little extra computation; the embedding table can be offloaded to host memory and overlapped with model computation through asynchronous prefetching.</li>\n<li><strong>Optimization</strong>: The <strong>Muon optimizer</strong> is used, refined around orthogonalization accuracy, the division of labour between Muon and AdamW, and the splitting of fused parameters, with the scaling law refitted for the new architecture.</li>\n</ul>\n<p>Qwen3.8-Flash-Next features a <strong>125B</strong>-parameter main model, supplemented by an additional <strong>51B</strong> N-gram embeddings, with <strong>6B</strong> parameters activated per token. Compared with Qwen3.7-Plus, Qwen3.8-Flash-Next substantially reduces both training and inference cost — training takes only about 1/9 as much, yet it delivers superior capabilities in coding and office tasks.</p>\n<p>It natively supports <strong>262,144</strong> tokens of context and is extensible to <strong>1,000,000</strong> tokens with YaRN. For more technical details on the architecture, training methodology, and experimental analysis of Qwen3.8-Flash-Next, please refer to the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://github.com/QwenLM/Qwen3.8-Flash-Next/blob/main/tech_report.pdf\">technical report</a> in our GitHub repository.</p>\n<p>Qwen3.8-Flash-Next weights are now available on <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/Qwen/Qwen3.8-Flash-Next\">Hugging Face</a> and <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://modelscope.cn/models/Qwen/Qwen3.8-Flash-Next\">ModelScope</a>. The production version, with 1M context by default and official built-in tools, is served as <strong>Qwen3.8-Flash</strong> on <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://www.qwencloud.com/models/qwen3.8-flash\">QwenCloud</a>, <strong>priced at 0.15 USD per million input tokens and 0.47 USD per million output tokens</strong>.</p>\n<h2>Performance</h2>\n<h3>Language</h3>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>Qwen3.8-Flash-Next</th>\n<th>Qwen3.8-27B</th>\n<th>Qwen3.7-Plus</th>\n<th>DeepSeek-V4-Flash-0731</th>\n<th>Claude-Opus-4.6 (Max)</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td># Params</td>\n<td>125B</td>\n<td>27B</td>\n<td>397B</td>\n<td>284B</td>\n<td>--</td>\n</tr>\n<tr>\n<td># Activated params</td>\n<td>6B</td>\n<td>27B</td>\n<td>17B</td>\n<td>13B</td>\n<td>--</td>\n</tr>\n<tr>\n<td># N-gram embedding params</td>\n<td>51B</td>\n<td>--</td>\n<td>--</td>\n<td>--</td>\n<td>--</td>\n</tr>\n<tr>\n<td>Coding</td>\n<td></td>\n<td></td>\n<td></td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>Agentic coding  DeepSWE 1.1</td>\n<td><strong>58.7</strong></td>\n<td>42.2</td>\n<td>16.5</td>\n<td>54.4</td>\n<td>--</td>\n</tr>\n<tr>\n<td>Agentic coding  SWE-bench Pro</td>\n<td><strong>62.5</strong></td>\n<td>61.7</td>\n<td>55.8</td>\n<td>56.0</td>\n<td>53.4</td>\n</tr>\n<tr>\n<td>Multilingual software engineering  SWE-bench Multilingual</td>\n<td><strong>81.0</strong></td>\n<td>73.8</td>\n<td>75.8</td>\n<td>--</td>\n<td>77.5</td>\n</tr>\n<tr>\n<td>Repo-level code generation  NL2Repo-Bench</td>\n<td>48.1</td>\n<td>42.3</td>\n<td>41.1</td>\n<td><strong>54.2</strong></td>\n<td>47.6</td>\n</tr>\n<tr>\n<td>Agent</td>\n<td></td>\n<td></td>\n<td></td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>Long-horizon office work  CoWorkBench</td>\n<td><strong>73.9</strong></td>\n<td>70.7</td>\n<td>65.1</td>\n<td>45.1</td>\n<td>68.2</td>\n</tr>\n<tr>\n<td>Professional job tasks  JobBench</td>\n<td><strong>55.7</strong></td>\n<td>33.4</td>\n<td>27.6</td>\n<td>41.3</td>\n<td>36.6</td>\n</tr>\n<tr>\n<td>Frontier agentic tasks  Agents' Last Exam</td>\n<td>Pass@1  24.3  Score  <strong>51.2</strong></td>\n<td>Pass@1  20.4  Score  42.9</td>\n<td>Pass@1  13.2  Score  33.6</td>\n<td>Pass@1  <strong>25.2</strong>  Score  --</td>\n<td>--</td>\n</tr>\n<tr>\n<td>Real-world tool use  Toolathlon Verified (Pass@1)</td>\n<td><strong>73.5</strong></td>\n<td>67.1</td>\n<td>50.6</td>\n<td>70.3</td>\n<td>--</td>\n</tr>\n<tr>\n<td>General</td>\n<td></td>\n<td></td>\n<td></td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>Instruction following  IFBench</td>\n<td><strong>81.3</strong></td>\n<td>79.5</td>\n<td>79.1</td>\n<td>79.2</td>\n<td>62.5</td>\n</tr>\n<tr>\n<td>Scientific reasoning  GPQA Diamond</td>\n<td><strong>91.7</strong></td>\n<td>89.2</td>\n<td>90.3</td>\n<td>90.8</td>\n<td>91.3</td>\n</tr>\n<tr>\n<td>Multidisciplinary reasoning  HLE</td>\n<td>35.9</td>\n<td>30.8</td>\n<td>34.7</td>\n<td>33.8</td>\n<td><strong>40.0</strong></td>\n</tr>\n<tr>\n<td>Competitive coding  LiveCodeBench v6</td>\n<td><strong>91.9</strong></td>\n<td>90.3</td>\n<td>89.6</td>\n<td>90.6</td>\n<td>88.8</td>\n</tr>\n</tbody>\n</table>\n<p>1. DeepSWE 1.1: evaluated with the Claude Code and mini-SWE-agent harnesses, temp=1.0, top_p=0.95, 256K context window. We report the highest score across the two harnesses; notably, Qwen3.8-Flash-Next performs best on mini-SWE-agent.<br />\n2. SWE-bench Pro: except for Claude-Opus-4.6 (Max), for which we report the officially published score, all models are evaluated with the Claude Code harness, temp=1.0, top_p=0.95, 256K context window. Problematic tasks were corrected and all baseline models were re-evaluated on the refined benchmark.<br />\n3. SWE-bench Multilingual: evaluated with the mini-SWE-agent harness, temp=1.0, top_p=0.95, 256K context window.<br />\n4. NL2Repo-Bench: evaluated with the Claude Code harness. To prevent reward hacking, we disable Bash commands that attempt to access the specific repository, such as pip download, pip install and git clone.<br />\n5. CoWorkBench: an in-house cowork benchmark for evaluating long-horizon office and productivity agent tasks across computer science, finance, law, medical and other productivity domains.<br />\n6. HLE: judged by GPT-4o.<br />\n7. The best result in each row is shown in bold.<br />\n8. Empty cells (--): scores are not yet available or are not applicable.</p>\n<h3>Vision Language</h3>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>Qwen3.8-Flash-Next</th>\n<th>Qwen3.8-27B</th>\n<th>Qwen3.7-Plus</th>\n<th>Claude-Opus-4.6 (Max)</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Agentic Multimodal Intelligence</td>\n<td></td>\n<td></td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>Multimodal tool use  ClawEval-MM</td>\n<td>Pass@3  <strong>64.4</strong>  Average  <strong>60.4</strong></td>\n<td>Pass@3  57.4  Average  56.9</td>\n<td>Pass@3  57.4  Average  60.1</td>\n<td>Pass@3  52.5  Average  54.7</td>\n</tr>\n<tr>\n<td>Application recreation  RecreationBench</td>\n<td><strong>49.9</strong></td>\n<td>47.1</td>\n<td>30.2</td>\n<td>--</td>\n</tr>\n<tr>\n<td>Mobile use  AndroidWorld</td>\n<td><strong>84.5</strong></td>\n<td>81.9</td>\n<td>81.0</td>\n<td>62.0</td>\n</tr>\n<tr>\n<td>Computer use  OSWorld 2.0</td>\n<td>Binary  <strong>19.4</strong>  Partial  <strong>52.3</strong></td>\n<td>Binary  19.4  Partial  48.0</td>\n<td>Binary  2.8  Partial  21.5</td>\n<td>--</td>\n</tr>\n<tr>\n<td>Visual web development  Vision2Web</td>\n<td><strong>64.0</strong></td>\n<td>62.9</td>\n<td>42.1</td>\n<td>--</td>\n</tr>\n<tr>\n<td>General Multimodal Intelligence</td>\n<td></td>\n<td></td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>Embodied intelligence  ERQA</td>\n<td><strong>72.3</strong></td>\n<td>65.5</td>\n<td>69.8</td>\n<td>40.8</td>\n</tr>\n<tr>\n<td>Long video understanding  LVBench</td>\n<td><strong>76.6</strong></td>\n<td>72.4</td>\n<td>76.2</td>\n<td>63.0</td>\n</tr>\n<tr>\n<td>Real-world perception  RealWorldQA</td>\n<td><strong>88.5</strong></td>\n<td>85.9</td>\n<td>86.9</td>\n<td>73.9</td>\n</tr>\n<tr>\n<td>Visual math problem solving  MathVision</td>\n<td>Without CI  <strong>90.6</strong>  With CI  <strong>95.7</strong></td>\n<td>Without CI  90.0  With CI  94.6</td>\n<td>Without CI  90.3  With CI  88.7</td>\n<td>Without CI  65.5</td>\n</tr>\n<tr>\n<td>Scientific chart analysis  CharXiv (RQ)</td>\n<td>Without CI  84.6  With CI  <strong>90.6</strong></td>\n<td>Without CI  83.7  With CI  90.2</td>\n<td>Without CI  <strong>85.8</strong>  With CI  85.9</td>\n<td>Without CI  66.0</td>\n</tr>\n</tbody>\n</table>\n<p>1. ClawEval-MM: scores are reported as &quot;pass@3 / average score&quot;. Pass@3 measures the percentage passed in at least one of three trials, and the average score is the mean score across the three trials.<br />\n2. RecreationBench: an in-house long-horizon application-recreation benchmark for evaluating hybrid-agent abilities spanning five platforms — desktop (Ubuntu, macOS, Windows), mobile (Android) and web.<br />\n3. OSWorld 2.0: scores are reported as &quot;binary / partial&quot;. The binary score is the percentage of tasks that receive the full task reward, while the partial score aggregates the partial rewards obtained across all tasks.<br />\n4. Vision2Web: scores are reported as the average over the frontend, webpage and website categories, using the Claude Code harness and judged by gpt-5.4-2026-03-05.<br />\n5. MathVision, CharXiv (RQ): scores are reported as &quot;without CI / with CI&quot;. A small number of incorrect ground-truth annotations in MathVision were corrected after manual verification. Our model's score is evaluated using a fixed prompt, e.g. &quot;Please reason step by step, and put your final answer within \\boxed{}.&quot; For other models, we report the higher score between runs with and without the \\boxed{} formatting.<br />\n6. The best result in each row is shown in bold.<br />\n7. Empty cells (--) indicate scores not yet available or not applicable.</p>\n<h2>Model Architecture</h2>\n<p><picture class=\"article-picture article-picture-fallback\" style=\"--image-ratio:16 / 9\"><img src=\"https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.8-Flash-Next/architecture.png#center\" alt=\"Qwen3.8-Flash-Next architecture\" loading=\"lazy\" decoding=\"async\" fetchpriority=\"low\" referrerpolicy=\"no-referrer\" class=\"progressive-image\"></picture></p>\n<h3>Attention: GDN + QSA for Efficient Memory and Precise Retrieval</h3>\n<p>Traditional Full Attention provides direct access to all previous tokens, but as the context grows longer, both computation and KV Cache memory-access costs increase substantially.</p>\n<p>Following the architecture design introduced in Qwen3.5, Qwen3.8-Flash-Next adopts a <strong>GDN <sup class=\"citation-ref\"><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://qwen.ai/blog/qwen3.8-flash-next/#ref1\">[1]</a></sup> + Attention Hybrid architecture</strong>: three out of every four layers use Gated DeltaNet (GDN) to continuously compress historical information into a fixed-size state, while the remaining layer uses global Attention for precise retrieval of information across the full context.</p>\n<p>For global Attention, we further introduce <strong>Qwen Sparse Attention (QSA)</strong>. Sparse Attention reduces long-sequence computation by attending only to important context. However, existing approaches such as DSA <sup class=\"citation-ref\"><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://qwen.ai/blog/qwen3.8-flash-next/#ref2\">[2]</a></sup> still rely on a token-level indexer to identify important positions; as the context grows, the indexer itself becomes a non-negligible source of computation.</p>\n<p>QSA further compresses this process: a lightweight indexer first aggregates the sequence into <strong>micro-blocks</strong>, estimates context importance at the block level, and then selects the most relevant regions for Attention. This reduces not only the cost of Attention itself, but also the indexing overhead required to identify important context. Compared with approaches that share indices across layers <sup class=\"citation-ref\"><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://qwen.ai/blog/qwen3.8-flash-next/#ref3\">[3]</a></sup>, QSA performs sequence compression independently within each layer, reducing its dependence on cross-layer Attention similarity and making it particularly well suited to Hybrid architectures where GDN and Attention layers are interleaved.</p>\n<p><picture class=\"article-picture article-picture-fallback\" style=\"--image-ratio:16 / 9\"><img src=\"https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.8-Flash-Next/qsa_arch.png#center\" alt=\"Overview of Qwen Sparse Attention (QSA)\" loading=\"lazy\" decoding=\"async\" fetchpriority=\"low\" referrerpolicy=\"no-referrer\" class=\"progressive-image\"></picture></p>\n<p>Put simply: <strong>GDN efficiently “remembers,” while QSA precisely “retrieves.”</strong></p>\n<p>At <strong>1M tokens</strong>, QSA’s Attention Kernel achieves up to <strong>7.6×</strong> and <strong>4.9×</strong> speedups in Prefill and Decode, respectively. In an experimental setup representative of online serving scenarios with high cache reuse (a <strong>90% Prefix Cache hit rate</strong>), Qwen3.8-Flash-Next achieves <strong>8.6×</strong> the Prefill throughput of Qwen3.7-Plus at a <strong>1M-token context length</strong>.</p>\n<p><picture class=\"article-picture article-picture-fallback\" style=\"--image-ratio:16 / 9\"><img src=\"https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.8-Flash-Next/throughput.png#center\" alt=\"Relative prefill throughput at 90% cache hit rate\" loading=\"lazy\" decoding=\"async\" fetchpriority=\"low\" referrerpolicy=\"no-referrer\" class=\"progressive-image\"></picture></p>\n<h3>Gated Residual: More Paths for Information Flow</h3>\n<p>In a traditional Transformer, all layers continuously read from and write to the same Residual Stream. As the network becomes deeper, early features are repeatedly mixed with later information, making important signals more likely to be gradually diluted.</p>\n<p><strong>Gated Residual (GR)</strong> can be viewed as a combination of two ideas: it follows <strong>Hyper-Connection</strong> <sup class=\"citation-ref\"><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://qwen.ai/blog/qwen3.8-flash-next/#ref4\">[4]</a></sup> in widening the residual stream into multiple branches, while incorporating the element-wise dynamic gating of <strong>GatedNorm</strong> <sup class=\"citation-ref\"><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://qwen.ai/blog/qwen3.8-flash-next/#ref5\">[5]</a></sup> into the residual read. The original single residual stream is expanded into four parallel branches, allowing the model to dynamically determine how much information to read from each branch and how much to write back to each branch based on the current content.</p>\n<p>This can be conceptualized as expanding a single information channel into multiple parallel pathways: some branches handle local information flow, while others preserve early information directly deep into the network layers. Empirical analysis also reveals that one of these branches naturally emerges as a long-range pathway connecting the first Attention layer to most of the middle and subsequent layers.</p>\n<p>GR also further simplifies Hyper-Connection. Once the read and write operations are expressive enough, additional branch mixing yields no significant benefits and can thus be directly removed, thereby reducing memory access overhead and sources of instability. The Gate also effectively suppresses <strong>activation outliers</strong> and improves training stability. In addition, the Residual State supports <strong>FP8</strong> storage, further reducing memory-access overhead.</p>\n<h3>N-gram Embedding: Expanding Model Capacity at Low Cost</h3>\n<p>Inspired by Per-Layer Embedding in Gemma 3n and works such as DeepSeek Engram <sup class=\"citation-ref\"><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://qwen.ai/blog/qwen3.8-flash-next/#ref6\">[6]</a></sup>, we further introduce <strong>N-gram Embedding</strong> to scale model capacity beyond the parameters of the Transformer backbone.</p>\n<p>A standard Embedding performs a lookup based on a single token. N-gram Embedding instead performs lookups using the local context formed by the current token and several preceding tokens, providing additional representations for common phrases and local patterns.</p>\n<p>Its key advantage is that it <strong>can add a large number of parameters with almost no additional computation per token</strong>.</p>\n<p>Qwen3.8-Flash-Next introduces an additional <strong>51B N-gram Embedding parameters</strong>. Because lookup locations can be determined in advance, these parameters can be stored in Host Memory and asynchronously prefetched in parallel with model computation, without permanently occupying GPU memory.</p>\n<p>The final model uses only a single N-gram Embedding layer near the beginning of the network, effectively adding a large-scale <strong>“local-pattern memory”</strong> at relatively low additional cost.</p>\n<h3>Optimization: Co-designing Architecture and Optimization</h3>\n<p>Qwen3.8-Flash-Next is trained with the <strong>Muon Optimizer</strong> <sup class=\"citation-ref\"><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://qwen.ai/blog/qwen3.8-flash-next/#ref7\">[7]</a></sup>, with further improvements around three key aspects of applying Muon to large-scale model training: <strong>orthogonalization accuracy, parameter assignment between Muon and AdamW, and splitting fused parameter matrices</strong>.</p>\n<p>For parameters that genuinely act as two-dimensional linear maps, such as the main weights in Attention, GDN, and MoE Experts, we use Muon. Embeddings, the MoE Router, and the low-rank parameters in GR continue to use AdamW. For QKV, SwiGLU, and GDN projections that are fused in the implementation, we first split them according to the independent linear transformations they represent, and then perform orthogonalization separately.</p>\n<p>For the new architecture and Optimizer, we refit the Scaling Law. The results show that the model can stably use <strong>larger Learning Rates and Batch Sizes</strong>, further improving convergence efficiency and large-scale parallel training throughput.</p>\n<p>We also find that <strong>Batch Size Warmup</strong>, a common practice in large-scale model training, is no longer necessary: gradually increasing from a small Batch to the target Batch does not improve the final result, but instead requires <strong>18.8% more optimizer steps</strong>. In the final training Recipe, we therefore start directly with the target Batch Size.</p>\n<h3>Other Architecture Optimizations</h3>\n<p>The remaining components follow the design established in Qwen3-Next and refined through the Qwen3.5–Qwen3.8 series.</p>\n<ul>\n<li><strong>Ultra-sparse MoE</strong>: With global load balancing <sup class=\"citation-ref\"><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://qwen.ai/blog/qwen3.8-flash-next/#ref8\">[8]</a></sup>, increasing total expert parameters while keeping the number of activated experts fixed steadily reduces training loss. Qwen3.8-Flash-Next therefore uses a large expert pool with a small number of routed experts per token, together with one shared expert.</li>\n<li><strong>Multi-Token Prediction</strong>: The MTP module is trained with multiple steps, maintaining consistency between training and inference and thereby improving the acceptance rate of speculative decoding in real scenarios, while also enhancing the performance of the backbone. Its full-attention layers are replaced with QSA as well.</li>\n<li><strong>Training stability</strong>: Zero-centered RMSNorm with weight decay applied to norm weights, the attention output gating mechanism <sup class=\"citation-ref\"><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://qwen.ai/blog/qwen3.8-flash-next/#ref9\">[9]</a></sup>, and normalized MoE router initialization are retained. These designs make small-scale ablations more reliable and help large-scale training run smoothly.</li>\n</ul>\n<h2>Base Model Performance</h2>\n<p>We compare Qwen3.8-Flash-Next-Base with the base models of Qwen3.8-27B and Qwen3.7-Plus.</p>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>Qwen3.8-Flash-Next-Base</th>\n<th>Qwen3.8-27B-Base</th>\n<th>Qwen3.7-Plus-Base</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td># Params</td>\n<td>125B</td>\n<td>27B</td>\n<td>397B</td>\n</tr>\n<tr>\n<td># Activated params</td>\n<td>6B</td>\n<td>27B</td>\n<td>17B</td>\n</tr>\n<tr>\n<td># N-gram embedding params</td>\n<td>51B</td>\n<td>--</td>\n<td>--</td>\n</tr>\n<tr>\n<td>General tasks</td>\n<td></td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>MMLU</td>\n<td>90.36</td>\n<td>87.51</td>\n<td><strong>90.43</strong></td>\n</tr>\n<tr>\n<td>MMLU-Redux</td>\n<td>90.68</td>\n<td>87.26</td>\n<td><strong>91.47</strong></td>\n</tr>\n<tr>\n<td>MMLU-Pro</td>\n<td><strong>73.23</strong></td>\n<td>68.60</td>\n<td>70.90</td>\n</tr>\n<tr>\n<td>SuperGPQA</td>\n<td><strong>51.36</strong></td>\n<td>44.86</td>\n<td>48.42</td>\n</tr>\n<tr>\n<td>BBH</td>\n<td><strong>90.87</strong></td>\n<td>89.56</td>\n<td>89.41</td>\n</tr>\n<tr>\n<td>Math &amp; STEM tasks</td>\n<td></td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>GPQA</td>\n<td>51.42</td>\n<td>45.01</td>\n<td><strong>51.52</strong></td>\n</tr>\n<tr>\n<td>GSM8K</td>\n<td><strong>93.29</strong></td>\n<td>93.18</td>\n<td>92.95</td>\n</tr>\n<tr>\n<td>MATH</td>\n<td>72.78</td>\n<td>60.54</td>\n<td><strong>74.38</strong></td>\n</tr>\n<tr>\n<td>Coding tasks</td>\n<td></td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>EvalPlus</td>\n<td><strong>78.76</strong></td>\n<td>76.05</td>\n<td>78.06</td>\n</tr>\n<tr>\n<td>MultiPL-E</td>\n<td>79.09</td>\n<td>74.50</td>\n<td><strong>81.68</strong></td>\n</tr>\n<tr>\n<td>SWEBench-Pretrain</td>\n<td><strong>50.99</strong></td>\n<td>41.66</td>\n<td>49.24</td>\n</tr>\n<tr>\n<td>Multilingual tasks</td>\n<td></td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>MGSM</td>\n<td><strong>89.33</strong></td>\n<td>86.37</td>\n<td>85.42</td>\n</tr>\n<tr>\n<td>MMMLU</td>\n<td><strong>84.86</strong></td>\n<td>79.74</td>\n<td>84.53</td>\n</tr>\n<tr>\n<td>INCLUDE</td>\n<td>78.40</td>\n<td>74.37</td>\n<td><strong>78.90</strong></td>\n</tr>\n</tbody>\n</table>\n<p>1. The best result in each row is shown in bold.<br />\n2. Empty cells (--): scores are not yet available or not applicable.</p>\n<p>With 6B activated parameters, Qwen3.8-Flash-Next-Base achieves the best result on 8 of the 14 benchmarks, including MMLU-Pro, SuperGPQA, BBH, GSM8K, EvalPlus, SWEBench-Pretrain, MGSM and MMMLU, and remains close to Qwen3.7-Plus-Base on MMLU, MMLU-Redux, GPQA, MATH and MultiPL-E. The 51B N-gram embedding parameters are deterministically addressed and do not enter the per-token matrix-multiplication budget.</p>\n<h2>Develop with Qwen3.8-Flash-Next</h2>\n<p>Qwen3.8-Flash-Next is available as an open-weight model on <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/collections/Qwen/qwen38-flash-next\">HuggingFace</a> and <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://www.modelscope.cn/collections/Qwen/Qwen38-Flash-Next\">ModelScope</a>, with official managed APIs on <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://www.qwencloud.com/models/qwen3.8-flash\">QwenCloud</a>. Designed to balance capability, latency, and cost, it is well suited for high-volume applications, tool-driven workflows, and coding &amp; coworking assistants. In the following, you can explore how to call the QwenCloud API and integrate Qwen3.8-Flash-Next into agentic systems and coding assistants.</p>\n<h3>API Usage</h3>\n<p>Qwen3.8-Flash-Next is available via API:</p>\n<h4>QwenCloud</h4>\n<p>On <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://www.qwencloud.com\">QwenCloud</a>, the model is served under the name <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://www.qwencloud.com/models/qwen3.8-flash\"><code>qwen3.8-flash</code></a>. QwenCloud supports industry-standard protocols, including OpenAI-compatible Chat Completions and Responses APIs, alongside an Anthropic-compatible interface.</p>\n<pre><code class=\"language-python\"><span class=\"code-snippet\" data-language=\"Python\"><span class=\"syntax-source syntax-python\"><span class=\"syntax-comment syntax-block syntax-documentation syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-comment syntax-begin syntax-python\">&quot;&quot;&quot;</span>\nEnvironment variables:\n  DASHSCOPE_API_KEY: Your API Key from https://home.qwencloud.com/\n  DASHSCOPE_BASE_URL: (optional) Base URL for compatible-mode API.\n    - Beijing: https://dashscope.aliyuncs.com/compatible-mode/v1\n    - Singapore: https://dashscope-intl.aliyuncs.com/compatible-mode/v1\n    - US (Virginia): https://dashscope-us.aliyuncs.com/compatible-mode/v1\n<span class=\"syntax-punctuation syntax-definition syntax-comment syntax-end syntax-python\">&quot;&quot;&quot;</span></span>\n<span class=\"syntax-meta syntax-statement syntax-import syntax-python\"><span class=\"syntax-keyword syntax-control syntax-import syntax-from syntax-python\">from</span></span><span class=\"syntax-meta syntax-statement syntax-import syntax-python\"><span class=\"syntax-meta syntax-import-source syntax-python\"> <span class=\"syntax-meta syntax-import-path syntax-python\"><span class=\"syntax-meta syntax-import-name syntax-python\">openai</span></span> <span class=\"syntax-meta syntax-statement syntax-import syntax-python\"><span class=\"syntax-keyword syntax-control syntax-import syntax-python\">import</span></span></span></span><span class=\"syntax-meta syntax-statement syntax-import syntax-python\"></span><span class=\"syntax-meta syntax-statement syntax-import syntax-python\"> <span class=\"syntax-meta syntax-generic-name syntax-python\">OpenAI</span></span>\n<span class=\"syntax-meta syntax-statement syntax-import syntax-python\"><span class=\"syntax-keyword syntax-control syntax-import syntax-python\">import</span> <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">os</span></span></span>\n\n<span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">api_key</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span> <span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">os</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span><span class=\"syntax-meta syntax-generic-name syntax-python\">environ</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span></span><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-variable syntax-function syntax-python\">get</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\"><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">DASHSCOPE_API_KEY<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n<span class=\"syntax-meta syntax-statement syntax-if syntax-python\"><span class=\"syntax-keyword syntax-control syntax-flow syntax-conditional syntax-python\">if</span> <span class=\"syntax-keyword syntax-operator syntax-logical syntax-python\">not</span> <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">api_key</span></span><span class=\"syntax-punctuation syntax-section syntax-block syntax-conditional syntax-python\">:</span></span>\n    <span class=\"syntax-meta syntax-statement syntax-raise syntax-python\"><span class=\"syntax-keyword syntax-control syntax-flow syntax-raise syntax-python\">raise</span> <span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-support syntax-type syntax-exception syntax-python\">ValueError</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\">\n        <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">DASHSCOPE_API_KEY is required. <span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span>\n        <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">Set it via: export DASHSCOPE_API_KEY=&#39;your-api-key&#39;<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span>\n    </span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span></span>\n\n<span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">client</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span> <span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-variable syntax-function syntax-python\">OpenAI</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\">\n    <span class=\"syntax-variable syntax-parameter syntax-python\">api_key</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">api_key</span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span>\n    <span class=\"syntax-variable syntax-parameter syntax-python\">base_url</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">os</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span><span class=\"syntax-meta syntax-generic-name syntax-python\">environ</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span></span><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-variable syntax-function syntax-python\">get</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\">\n        <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">DASHSCOPE_BASE_URL<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span>\n        <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">https://dashscope-intl.aliyuncs.com/compatible-mode/v1<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span>\n    </span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span>\n</span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n\n<span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">messages</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span> <span class=\"syntax-meta syntax-structure syntax-list syntax-python\"><span class=\"syntax-punctuation syntax-section syntax-list syntax-begin syntax-python\">[</span><span class=\"syntax-meta syntax-structure syntax-dictionary-or-set syntax-python\"><span class=\"syntax-punctuation syntax-section syntax-dictionary-or-set syntax-begin syntax-python\">{</span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">role<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-python\">:</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">user<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary-or-set syntax-python\">,</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">content<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-python\">:</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">Write a Python function to merge two sorted linked lists.<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-section syntax-dictionary-or-set syntax-end syntax-python\">}</span></span><span class=\"syntax-punctuation syntax-section syntax-list syntax-end syntax-python\">]</span></span>\n\n<span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">completion</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span> <span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">client</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span><span class=\"syntax-meta syntax-generic-name syntax-python\">chat</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span><span class=\"syntax-meta syntax-generic-name syntax-python\">completions</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span></span><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-variable syntax-function syntax-python\">create</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\">\n    <span class=\"syntax-variable syntax-parameter syntax-python\">model</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">qwen3.8-flash<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span>\n    <span class=\"syntax-variable syntax-parameter syntax-python\">messages</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">messages</span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span>\n    <span class=\"syntax-variable syntax-parameter syntax-python\">extra_body</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-structure syntax-dictionary-or-set syntax-python\"><span class=\"syntax-punctuation syntax-section syntax-dictionary-or-set syntax-begin syntax-python\">{</span>\n        <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">enable_thinking<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-python\">:</span> <span class=\"syntax-constant syntax-language syntax-python\">True</span><span class=\"syntax-punctuation syntax-separator syntax-dictionary-or-set syntax-python\">,</span>\n        <span class=\"syntax-comment syntax-line syntax-number-sign syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-comment syntax-python\">#</span> &quot;preserve_thinking&quot;: True,\n</span>    <span class=\"syntax-punctuation syntax-section syntax-dictionary-or-set syntax-end syntax-python\">}</span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span>\n    <span class=\"syntax-variable syntax-parameter syntax-python\">reasoning_effort</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">xhigh<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span>  <span class=\"syntax-comment syntax-line syntax-number-sign syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-comment syntax-python\">#</span> supported levels are xhigh, medium, and low\n</span>    <span class=\"syntax-variable syntax-parameter syntax-python\">stream</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-constant syntax-language syntax-python\">True</span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span>\n</span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n\n<span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">reasoning_content</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span>\n<span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">answer_content</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span>\n<span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">is_answering</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span> <span class=\"syntax-constant syntax-language syntax-python\">False</span>\n<span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-support syntax-function syntax-builtin syntax-python\">print</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\"><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-constant syntax-character syntax-escape syntax-python\">\\n</span><span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span> <span class=\"syntax-keyword syntax-operator syntax-arithmetic syntax-python\">+</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">=<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span> <span class=\"syntax-keyword syntax-operator syntax-arithmetic syntax-python\">*</span> <span class=\"syntax-constant syntax-numeric syntax-integer syntax-decimal syntax-python\">20</span> <span class=\"syntax-keyword syntax-operator syntax-arithmetic syntax-python\">+</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">Reasoning<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span> <span class=\"syntax-keyword syntax-operator syntax-arithmetic syntax-python\">+</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">=<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span> <span class=\"syntax-keyword syntax-operator syntax-arithmetic syntax-python\">*</span> <span class=\"syntax-constant syntax-numeric syntax-integer syntax-decimal syntax-python\">20</span> <span class=\"syntax-keyword syntax-operator syntax-arithmetic syntax-python\">+</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-constant syntax-character syntax-escape syntax-python\">\\n</span><span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n\n<span class=\"syntax-meta syntax-statement syntax-for syntax-python\"><span class=\"syntax-keyword syntax-control syntax-flow syntax-for syntax-python\">for</span> <span class=\"syntax-meta syntax-generic-name syntax-python\">chunk</span> <span class=\"syntax-meta syntax-statement syntax-for syntax-python\"><span class=\"syntax-keyword syntax-control syntax-flow syntax-for syntax-in syntax-python\">in</span></span></span><span class=\"syntax-meta syntax-statement syntax-for syntax-python\"> <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">completion</span></span><span class=\"syntax-punctuation syntax-section syntax-block syntax-for syntax-python\">:</span></span>\n    <span class=\"syntax-meta syntax-statement syntax-if syntax-python\"><span class=\"syntax-keyword syntax-control syntax-flow syntax-conditional syntax-python\">if</span> <span class=\"syntax-keyword syntax-operator syntax-logical syntax-python\">not</span> <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">chunk</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span><span class=\"syntax-meta syntax-generic-name syntax-python\">choices</span></span><span class=\"syntax-punctuation syntax-section syntax-block syntax-conditional syntax-python\">:</span></span>\n        <span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-support syntax-function syntax-builtin syntax-python\">print</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\"><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-constant syntax-character syntax-escape syntax-python\">\\n</span>Usage:<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n        <span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-support syntax-function syntax-builtin syntax-python\">print</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">chunk</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span><span class=\"syntax-meta syntax-generic-name syntax-python\">usage</span></span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n        <span class=\"syntax-keyword syntax-control syntax-flow syntax-python\">continue</span>\n\n    <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">delta</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span> <span class=\"syntax-meta syntax-item-access syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">chunk</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span><span class=\"syntax-meta syntax-generic-name syntax-python\">choices</span></span></span><span class=\"syntax-meta syntax-item-access syntax-python\"><span class=\"syntax-punctuation syntax-section syntax-brackets syntax-begin syntax-python\">[</span></span><span class=\"syntax-meta syntax-item-access syntax-arguments syntax-python\"><span class=\"syntax-constant syntax-numeric syntax-integer syntax-decimal syntax-python\">0</span></span><span class=\"syntax-meta syntax-item-access syntax-python\"><span class=\"syntax-punctuation syntax-section syntax-brackets syntax-end syntax-python\">]</span></span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span><span class=\"syntax-meta syntax-generic-name syntax-python\">delta</span>\n\n    <span class=\"syntax-meta syntax-statement syntax-if syntax-python\"><span class=\"syntax-keyword syntax-control syntax-flow syntax-conditional syntax-python\">if</span> <span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-support syntax-function syntax-builtin syntax-python\">hasattr</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">delta</span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">reasoning_content<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span> <span class=\"syntax-keyword syntax-operator syntax-logical syntax-python\">and</span> <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">delta</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span><span class=\"syntax-meta syntax-generic-name syntax-python\">reasoning_content</span></span> <span class=\"syntax-keyword syntax-operator syntax-logical syntax-python\">is</span> <span class=\"syntax-keyword syntax-operator syntax-logical syntax-python\">not</span> <span class=\"syntax-constant syntax-language syntax-python\">None</span><span class=\"syntax-punctuation syntax-section syntax-block syntax-conditional syntax-python\">:</span></span>\n        <span class=\"syntax-meta syntax-statement syntax-if syntax-python\"><span class=\"syntax-keyword syntax-control syntax-flow syntax-conditional syntax-python\">if</span> <span class=\"syntax-keyword syntax-operator syntax-logical syntax-python\">not</span> <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">is_answering</span></span><span class=\"syntax-punctuation syntax-section syntax-block syntax-conditional syntax-python\">:</span></span>\n            <span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-support syntax-function syntax-builtin syntax-python\">print</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">delta</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span><span class=\"syntax-meta syntax-generic-name syntax-python\">reasoning_content</span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span> <span class=\"syntax-variable syntax-parameter syntax-python\">end</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span> <span class=\"syntax-variable syntax-parameter syntax-python\">flush</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-constant syntax-language syntax-python\">True</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n        <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">reasoning_content</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-augmented syntax-python\">+=</span> <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">delta</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span><span class=\"syntax-meta syntax-generic-name syntax-python\">reasoning_content</span></span>\n\n    <span class=\"syntax-meta syntax-statement syntax-if syntax-python\"><span class=\"syntax-keyword syntax-control syntax-flow syntax-conditional syntax-python\">if</span> <span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-support syntax-function syntax-builtin syntax-python\">hasattr</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">delta</span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">content<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span> <span class=\"syntax-keyword syntax-operator syntax-logical syntax-python\">and</span> <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">delta</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span><span class=\"syntax-meta syntax-generic-name syntax-python\">content</span></span><span class=\"syntax-punctuation syntax-section syntax-block syntax-conditional syntax-python\">:</span></span>\n        <span class=\"syntax-meta syntax-statement syntax-if syntax-python\"><span class=\"syntax-keyword syntax-control syntax-flow syntax-conditional syntax-python\">if</span> <span class=\"syntax-keyword syntax-operator syntax-logical syntax-python\">not</span> <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">is_answering</span></span><span class=\"syntax-punctuation syntax-section syntax-block syntax-conditional syntax-python\">:</span></span>\n            <span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-support syntax-function syntax-builtin syntax-python\">print</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\"><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-constant syntax-character syntax-escape syntax-python\">\\n</span><span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span> <span class=\"syntax-keyword syntax-operator syntax-arithmetic syntax-python\">+</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">=<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span> <span class=\"syntax-keyword syntax-operator syntax-arithmetic syntax-python\">*</span> <span class=\"syntax-constant syntax-numeric syntax-integer syntax-decimal syntax-python\">20</span> <span class=\"syntax-keyword syntax-operator syntax-arithmetic syntax-python\">+</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">Answer<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span> <span class=\"syntax-keyword syntax-operator syntax-arithmetic syntax-python\">+</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">=<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span> <span class=\"syntax-keyword syntax-operator syntax-arithmetic syntax-python\">*</span> <span class=\"syntax-constant syntax-numeric syntax-integer syntax-decimal syntax-python\">20</span> <span class=\"syntax-keyword syntax-operator syntax-arithmetic syntax-python\">+</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-constant syntax-character syntax-escape syntax-python\">\\n</span><span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n            <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">is_answering</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span> <span class=\"syntax-constant syntax-language syntax-python\">True</span>\n        <span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-support syntax-function syntax-builtin syntax-python\">print</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">delta</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span><span class=\"syntax-meta syntax-generic-name syntax-python\">content</span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span> <span class=\"syntax-variable syntax-parameter syntax-python\">end</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span> <span class=\"syntax-variable syntax-parameter syntax-python\">flush</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-constant syntax-language syntax-python\">True</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n        <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">answer_content</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-augmented syntax-python\">+=</span> <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">delta</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span><span class=\"syntax-meta syntax-generic-name syntax-python\">content</span></span>\n</span></span></code></pre>\n<h3>Agent Frameworks &amp; Coding Assistants</h3>\n<p>Qwen3.8-Flash-Next integrates seamlessly with popular agent frameworks and coding assistants:</p>\n<h4>QwenWork</h4>\n<p><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://qwenwork.ai\">QwenWork</a> is Alibaba’s flagship AI productivity platform, designed to help individuals and enterprises automate daily tasks and accelerate operational efficiency.</p>\n<p>We are excited to share that QwenWork has integrated <strong>Qwen3.8-Flash-Next</strong> to power its newly launched “Standard” mode, leveraging the model’s cutting-edge capabilities to deliver a seamless, cost-effective experience that sets a new standard for AI agents in the workplace.</p>\n<p><picture class=\"article-picture article-picture-fallback\" style=\"--image-ratio:16 / 9\"><img src=\"https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.8-Flash-Next/qwen-work-ai.png#center\" alt=\"Qwen3.8-Flash on QwenWork\" loading=\"lazy\" decoding=\"async\" fetchpriority=\"low\" referrerpolicy=\"no-referrer\" class=\"progressive-image\"></picture></p>\n<p>Learn more in the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://docs.qwenwork.ai/product-introduction\">official documentation</a>!</p>\n<h4>Claude Code</h4>\n<p>Qwen APIs support the Anthropic API protocol, enabling direct use with <strong>Claude Code</strong>:</p>\n<pre><code class=\"language-bash\"><span class=\"code-snippet\" data-language=\"Shell\"><span class=\"syntax-source syntax-shell syntax-bash\"><span class=\"syntax-meta syntax-function-call syntax-shell\"><span class=\"syntax-variable syntax-function syntax-shell\">npm</span></span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-shell\"> install<span class=\"syntax-variable syntax-parameter syntax-option syntax-shell\"><span class=\"syntax-punctuation syntax-definition syntax-parameter syntax-shell\"> -</span>g</span> @anthropic-ai/claude-code</span>\n\n<span class=\"syntax-meta syntax-function-call syntax-shell\"><span class=\"syntax-storage syntax-modifier syntax-shell\">export</span> <span class=\"syntax-variable syntax-other syntax-readwrite syntax-assignment syntax-shell\">ANTHROPIC_MODEL</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-shell\">=</span><span class=\"syntax-string syntax-unquoted syntax-shell\"><span class=\"syntax-string syntax-quoted syntax-double syntax-shell\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-shell\">&quot;</span>qwen3.8-flash<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-shell\">&quot;</span></span></span></span>\n<span class=\"syntax-meta syntax-function-call syntax-shell\"><span class=\"syntax-storage syntax-modifier syntax-shell\">export</span> <span class=\"syntax-variable syntax-other syntax-readwrite syntax-assignment syntax-shell\">ANTHROPIC_SMALL_FAST_MODEL</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-shell\">=</span><span class=\"syntax-string syntax-unquoted syntax-shell\"><span class=\"syntax-string syntax-quoted syntax-double syntax-shell\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-shell\">&quot;</span>qwen3.8-flash<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-shell\">&quot;</span></span></span></span>\n<span class=\"syntax-meta syntax-function-call syntax-shell\"><span class=\"syntax-storage syntax-modifier syntax-shell\">export</span> <span class=\"syntax-variable syntax-other syntax-readwrite syntax-assignment syntax-shell\">ANTHROPIC_BASE_URL</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-shell\">=</span><span class=\"syntax-string syntax-unquoted syntax-shell\">https://dashscope-intl.aliyuncs.com/apps/anthropic</span></span>\n<span class=\"syntax-meta syntax-function-call syntax-shell\"><span class=\"syntax-storage syntax-modifier syntax-shell\">export</span> <span class=\"syntax-variable syntax-other syntax-readwrite syntax-assignment syntax-shell\">ANTHROPIC_AUTH_TOKEN</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-shell\">=</span><span class=\"syntax-string syntax-unquoted syntax-shell\">&lt;your_api_key&gt;</span></span>\n\n<span class=\"syntax-meta syntax-function-call syntax-shell\"><span class=\"syntax-variable syntax-function syntax-shell\">claude</span></span>\n</span></span></code></pre>\n<h4>Codex</h4>\n<p>Qwen APIs support the OpenAI Responses protocol, enabling use with <strong>Codex</strong>:</p>\n<p>In <code>~/.codex/model-catalog.local.json</code></p>\n<pre><code class=\"language-json\"><span class=\"code-snippet\" data-language=\"JSON\"><span class=\"syntax-source syntax-json\"><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-begin syntax-json\">{</span>\n  <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>models<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-meta syntax-structure syntax-array syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-array syntax-begin syntax-json\">[</span>\n    <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-begin syntax-json\">{</span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>slug<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>qwen3.8-flash<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>display_name<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>qwen3.8-flash<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>description<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>QwenCloud: Qwen3.8-Flash<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>default_reasoning_level<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>xhigh<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>supported_reasoning_levels<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-meta syntax-structure syntax-array syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-array syntax-begin syntax-json\">[</span>\n        <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-begin syntax-json\">{</span>\n          <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>effort<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>low<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n          <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>description<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>Fast responses with lighter reasoning<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span>\n        </span><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-end syntax-json\">}</span></span><span class=\"syntax-punctuation syntax-separator syntax-array syntax-json\">,</span>\n        <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-begin syntax-json\">{</span>\n          <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>effort<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>medium<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n          <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>description<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>Greater reasoning depth for complex problems<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span>\n        </span><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-end syntax-json\">}</span></span><span class=\"syntax-punctuation syntax-separator syntax-array syntax-json\">,</span>\n        <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-begin syntax-json\">{</span>\n          <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>effort<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>xhigh<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n          <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>description<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>Extra high reasoning depth for complex problems<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span>\n        </span><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-end syntax-json\">}</span></span>\n      <span class=\"syntax-punctuation syntax-section syntax-array syntax-end syntax-json\">]</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>context_window<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-constant syntax-numeric syntax-json\">1000000</span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>effective_context_window_percent<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-constant syntax-numeric syntax-json\">95</span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>supports_parallel_tool_calls<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-constant syntax-language syntax-json\">true</span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>supports_image_detail_original<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-constant syntax-language syntax-json\">true</span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>input_modalities<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-meta syntax-structure syntax-array syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-array syntax-begin syntax-json\">[</span><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>text<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-array syntax-json\">,</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>image<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-section syntax-array syntax-end syntax-json\">]</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>shell_type<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>default<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>visibility<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>list<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>supported_in_api<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-constant syntax-language syntax-json\">true</span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>priority<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-constant syntax-numeric syntax-json\">1</span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>base_instructions<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span><span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>support_verbosity<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-constant syntax-language syntax-json\">false</span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>supports_reasoning_summaries<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-constant syntax-language syntax-json\">false</span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>experimental_supported_tools<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-meta syntax-structure syntax-array syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-array syntax-begin syntax-json\">[</span><span class=\"syntax-punctuation syntax-section syntax-array syntax-end syntax-json\">]</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>truncation_policy<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-begin syntax-json\">{</span>\n        <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>mode<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>bytes<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n        <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>limit<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-constant syntax-numeric syntax-json\">10000</span>\n      </span><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-end syntax-json\">}</span></span>\n    </span><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-end syntax-json\">}</span></span>\n  <span class=\"syntax-punctuation syntax-section syntax-array syntax-end syntax-json\">]</span></span>\n</span><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-end syntax-json\">}</span></span>\n</span></span></code></pre>\n<p>In <code>~/.codex/config.toml</code></p>\n<pre><code class=\"language-toml\"><span class=\"code-snippet\" data-language=\"TOML\">model_catalog_json = &quot;~/.codex/model-catalog.local.json&quot;\n\nmodel_provider = &quot;QwenCloud&quot;\nmodel = &quot;qwen3.8-flash&quot;\n\n[model_providers.QwenCloud]\nname = &quot;QwenCloud&quot;\nbase_url = &quot;https://dashscope-intl.aliyuncs.com/compatible-mode/v1&quot;\nenv_key = &quot;OPENAI_API_KEY&quot;\nwire_api = &quot;responses&quot;\n</span></code></pre>\n<pre><code class=\"language-bash\"><span class=\"code-snippet\" data-language=\"Shell\"><span class=\"syntax-source syntax-shell syntax-bash\"><span class=\"syntax-meta syntax-function-call syntax-shell\"><span class=\"syntax-variable syntax-function syntax-shell\">npm</span></span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-shell\"> install<span class=\"syntax-variable syntax-parameter syntax-option syntax-shell\"><span class=\"syntax-punctuation syntax-definition syntax-parameter syntax-shell\"> -</span>g</span> @openai/codex</span>\n\n<span class=\"syntax-meta syntax-function-call syntax-shell\"><span class=\"syntax-storage syntax-modifier syntax-shell\">export</span> <span class=\"syntax-variable syntax-other syntax-readwrite syntax-assignment syntax-shell\">OPENAI_API_KEY</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-shell\">=</span><span class=\"syntax-string syntax-unquoted syntax-shell\">&lt;your_api_key&gt;</span></span>\n\n<span class=\"syntax-meta syntax-function-call syntax-shell\"><span class=\"syntax-variable syntax-function syntax-shell\">codex</span></span>\n</span></span></code></pre>\n<h4>Qoder CLI</h4>\n<p><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://qoder.com/\">Qoder</a> co-evolves with Qwen for agentic coding:</p>\n<pre><code class=\"language-bash\"><span class=\"code-snippet\" data-language=\"Shell\"><span class=\"syntax-source syntax-shell syntax-bash\"><span class=\"syntax-meta syntax-function-call syntax-shell\"><span class=\"syntax-variable syntax-function syntax-shell\">curl</span></span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-shell\"><span class=\"syntax-variable syntax-parameter syntax-option syntax-shell\"><span class=\"syntax-punctuation syntax-definition syntax-parameter syntax-shell\"> -</span>fsSL</span> https://qoder.com/install</span> <span class=\"syntax-keyword syntax-operator syntax-logical syntax-pipe syntax-shell\">|</span> <span class=\"syntax-meta syntax-function-call syntax-shell\"><span class=\"syntax-variable syntax-function syntax-shell\">bash</span></span>\n\n<span class=\"syntax-meta syntax-function-call syntax-shell\"><span class=\"syntax-variable syntax-function syntax-shell\">qoder</span></span>\n</span></span></code></pre>\n<h4>Qwen Code</h4>\n<p><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://qwen.ai/qwencode\">Qwen Code</a> is deeply optimized for the Qwen series:</p>\n<pre><code class=\"language-bash\"><span class=\"code-snippet\" data-language=\"Shell\"><span class=\"syntax-source syntax-shell syntax-bash\"><span class=\"syntax-meta syntax-function-call syntax-shell\"><span class=\"syntax-variable syntax-function syntax-shell\">npm</span></span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-shell\"> install<span class=\"syntax-variable syntax-parameter syntax-option syntax-shell\"><span class=\"syntax-punctuation syntax-definition syntax-parameter syntax-shell\"> -</span>g</span> @qwen-code/qwen-code@latest</span>\n\n<span class=\"syntax-meta syntax-function-call syntax-shell\"><span class=\"syntax-variable syntax-function syntax-shell\">qwen</span></span>\n</span></span></code></pre>\n<h4>OpenClaw</h4>\n<p>Connect to <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://openclaw.ai\">OpenClaw</a> via <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://docs.qwencloud.com/developer-guides/clients-and-developer-tools/openclaw\">QwenCloud</a>:</p>\n<pre><code class=\"language-bash\"><span class=\"code-snippet\" data-language=\"Shell\"><span class=\"syntax-source syntax-shell syntax-bash\"><span class=\"syntax-meta syntax-function-call syntax-shell\"><span class=\"syntax-variable syntax-function syntax-shell\">curl</span></span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-shell\"><span class=\"syntax-variable syntax-parameter syntax-option syntax-shell\"><span class=\"syntax-punctuation syntax-definition syntax-parameter syntax-shell\"> -</span>fsSL</span> https://openclaw.ai/install.sh</span> <span class=\"syntax-keyword syntax-operator syntax-logical syntax-pipe syntax-shell\">|</span> <span class=\"syntax-meta syntax-function-call syntax-shell\"><span class=\"syntax-variable syntax-function syntax-shell\">bash</span></span>\n\n<span class=\"syntax-meta syntax-function-call syntax-shell\"><span class=\"syntax-storage syntax-modifier syntax-shell\">export</span> <span class=\"syntax-variable syntax-other syntax-readwrite syntax-assignment syntax-shell\">DASHSCOPE_API_KEY</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-shell\">=</span><span class=\"syntax-string syntax-unquoted syntax-shell\">&lt;your_api_key&gt;</span></span>\n\n<span class=\"syntax-meta syntax-function-call syntax-shell\"><span class=\"syntax-variable syntax-function syntax-shell\">openclaw</span></span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-shell\"> dashboard</span>\n</span></span></code></pre>\n<p>Configure <code>~/.openclaw/openclaw.json</code>:</p>\n<pre><code class=\"language-json\"><span class=\"code-snippet\" data-language=\"JSON\"><span class=\"syntax-source syntax-json\"><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-begin syntax-json\">{</span>\n  <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>models<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-begin syntax-json\">{</span>\n    <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>mode<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>merge<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n    <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>providers<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-begin syntax-json\">{</span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>qwencloud<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-begin syntax-json\">{</span>\n        <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>baseUrl<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>https://dashscope-intl.aliyuncs.com/compatible-mode/v1<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n        <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>apiKey<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>DASHSCOPE_API_KEY<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n        <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>api<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>openai-completions<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n        <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>models<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-meta syntax-structure syntax-array syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-array syntax-begin syntax-json\">[</span>\n          <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-begin syntax-json\">{</span>\n            <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>id<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>qwen3.8-flash<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n            <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>name<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>qwen3.8-flash<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n            <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>reasoning<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-constant syntax-language syntax-json\">true</span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n            <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>input<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-meta syntax-structure syntax-array syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-array syntax-begin syntax-json\">[</span><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>text<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-array syntax-json\">,</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>image<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span><span class=\"syntax-punctuation syntax-section syntax-array syntax-end syntax-json\">]</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n            <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>contextWindow<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-constant syntax-numeric syntax-json\">1000000</span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n            <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>maxTokens<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-constant syntax-numeric syntax-json\">65536</span>\n          </span><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-end syntax-json\">}</span></span>\n        <span class=\"syntax-punctuation syntax-section syntax-array syntax-end syntax-json\">]</span></span>\n      </span><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-end syntax-json\">}</span></span>\n    </span><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-end syntax-json\">}</span></span>\n  </span><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-end syntax-json\">}</span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-pair syntax-json\">,</span></span>\n  <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>agents<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-begin syntax-json\">{</span>\n    <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>defaults<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-begin syntax-json\">{</span>\n      <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>model<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-json\"><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-begin syntax-json\">{</span>\n        <span class=\"syntax-meta syntax-structure syntax-dictionary syntax-key syntax-json\"><span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>primary<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span></span><span class=\"syntax-meta syntax-structure syntax-dictionary syntax-value syntax-json\"><span class=\"syntax-punctuation syntax-separator syntax-dictionary syntax-key-value syntax-json\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-json\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-json\">&quot;</span>qwencloud/qwen3.8-flash<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-json\">&quot;</span></span>\n      </span><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-end syntax-json\">}</span></span>\n    </span><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-end syntax-json\">}</span></span>\n  </span><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-end syntax-json\">}</span></span>\n</span><span class=\"syntax-punctuation syntax-section syntax-dictionary syntax-end syntax-json\">}</span></span>\n</span></span></code></pre>\n<h2>Summary</h2>\n<p>Qwen3.8-Flash-Next extends the hybrid architecture introduced in Qwen3-Next along four directions: attention, residual, embedding and optimization. QSA compresses the sequence into micro-blocks within each layer, reducing both the attention cost and the indexing cost at long context while keeping precise retrieval. Gated Residual widens the residual stream into several parallel branches and controls reads and writes with an elementwise, data-dependent gate, improving cross-layer information flow and training stability at negligible arithmetic cost; the residual state can additionally be kept in FP8, which further reduces memory traffic. N-gram embedding scales capacity through deterministically addressed lookup memory, which can be scaled with negligible per-token computation and offloaded to host memory. On the optimization side, Muon is used as the main optimizer, with orthogonalization accuracy, parameter assignment and fused-matrix splitting as the decisive implementation choices, and the scaling law refitted for the new architecture.</p>\n<p>We release these weights early so that the architecture can be evaluated independently by the community, as we did with Qwen3-Next, and we will continue to refine it towards Qwen4.</p>\n<h2>Citation</h2>\n<pre><code class=\"language-bibtex\"><span class=\"code-snippet\" data-language=\"Bibtex\"><span class=\"syntax-text syntax-bibtex\"><span class=\"syntax-meta syntax-entry syntax-braces syntax-bibtex\"><span class=\"syntax-keyword syntax-other syntax-entry-type syntax-bibtex\"><span class=\"syntax-punctuation syntax-definition syntax-keyword syntax-bibtex\">@</span>techreport</span><span class=\"syntax-punctuation syntax-section syntax-entry syntax-begin syntax-bibtex\">{</span><span class=\"syntax-entity syntax-name syntax-type syntax-entry-key syntax-bibtex\">qwen2026design</span>,\n    <span class=\"syntax-meta syntax-key-assignment syntax-bibtex\"><span class=\"syntax-string syntax-unquoted syntax-key syntax-bibtex\">title</span>       <span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-bibtex\">=</span> <span class=\"syntax-string syntax-quoted syntax-other syntax-braces syntax-bibtex\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-bibtex\">{</span>On the Design of <span class=\"syntax-punctuation syntax-definition syntax-group syntax-begin syntax-bibtex\">{</span>Qwen3.8-Next<span class=\"syntax-punctuation syntax-definition syntax-group syntax-end syntax-bibtex\">}</span> Architecture: Evaluation, Efficiency, and Training Stability<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-bibtex\">}</span></span></span>,\n    <span class=\"syntax-meta syntax-key-assignment syntax-bibtex\"><span class=\"syntax-string syntax-unquoted syntax-key syntax-bibtex\">author</span>      <span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-bibtex\">=</span> <span class=\"syntax-string syntax-quoted syntax-other syntax-braces syntax-bibtex\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-bibtex\">{</span><span class=\"syntax-punctuation syntax-definition syntax-group syntax-begin syntax-bibtex\">{</span>Qwen Team<span class=\"syntax-punctuation syntax-definition syntax-group syntax-end syntax-bibtex\">}</span><span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-bibtex\">}</span></span></span>,\n    <span class=\"syntax-meta syntax-key-assignment syntax-bibtex\"><span class=\"syntax-string syntax-unquoted syntax-key syntax-bibtex\">institution</span> <span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-bibtex\">=</span> <span class=\"syntax-string syntax-quoted syntax-other syntax-braces syntax-bibtex\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-bibtex\">{</span>Alibaba Group<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-bibtex\">}</span></span></span>,\n    <span class=\"syntax-meta syntax-key-assignment syntax-bibtex\"><span class=\"syntax-string syntax-unquoted syntax-key syntax-bibtex\">month</span>       <span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-bibtex\">=</span> <span class=\"syntax-string syntax-quoted syntax-other syntax-braces syntax-bibtex\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-bibtex\">{</span>August<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-bibtex\">}</span></span></span>,\n    <span class=\"syntax-meta syntax-key-assignment syntax-bibtex\"><span class=\"syntax-string syntax-unquoted syntax-key syntax-bibtex\">year</span>        <span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-bibtex\">=</span> <span class=\"syntax-string syntax-quoted syntax-other syntax-braces syntax-bibtex\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-bibtex\">{</span>2026<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-bibtex\">}</span></span>\n</span><span class=\"syntax-punctuation syntax-section syntax-entry syntax-end syntax-bibtex\">}</span></span>\n\n<span class=\"syntax-meta syntax-entry syntax-braces syntax-bibtex\"><span class=\"syntax-keyword syntax-other syntax-entry-type syntax-bibtex\"><span class=\"syntax-punctuation syntax-definition syntax-keyword syntax-bibtex\">@</span>misc</span><span class=\"syntax-punctuation syntax-section syntax-entry syntax-begin syntax-bibtex\">{</span><span class=\"syntax-entity syntax-name syntax-type syntax-entry-key syntax-bibtex\">qwen3.8flashnext</span>,\n    <span class=\"syntax-meta syntax-key-assignment syntax-bibtex\"><span class=\"syntax-string syntax-unquoted syntax-key syntax-bibtex\">title</span>  <span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-bibtex\">=</span> <span class=\"syntax-string syntax-quoted syntax-other syntax-braces syntax-bibtex\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-bibtex\">{</span><span class=\"syntax-punctuation syntax-definition syntax-group syntax-begin syntax-bibtex\">{</span>Qwen3.8-Flash-Next<span class=\"syntax-punctuation syntax-definition syntax-group syntax-end syntax-bibtex\">}</span>: A New Architecture, Towards Ultimate Cost-Efficiency<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-bibtex\">}</span></span></span>,\n    <span class=\"syntax-meta syntax-key-assignment syntax-bibtex\"><span class=\"syntax-string syntax-unquoted syntax-key syntax-bibtex\">author</span> <span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-bibtex\">=</span> <span class=\"syntax-string syntax-quoted syntax-other syntax-braces syntax-bibtex\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-bibtex\">{</span><span class=\"syntax-punctuation syntax-definition syntax-group syntax-begin syntax-bibtex\">{</span>Qwen Team<span class=\"syntax-punctuation syntax-definition syntax-group syntax-end syntax-bibtex\">}</span><span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-bibtex\">}</span></span></span>,\n    <span class=\"syntax-meta syntax-key-assignment syntax-bibtex\"><span class=\"syntax-string syntax-unquoted syntax-key syntax-bibtex\">month</span>  <span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-bibtex\">=</span> <span class=\"syntax-string syntax-quoted syntax-other syntax-braces syntax-bibtex\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-bibtex\">{</span>August<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-bibtex\">}</span></span></span>,\n    <span class=\"syntax-meta syntax-key-assignment syntax-bibtex\"><span class=\"syntax-string syntax-unquoted syntax-key syntax-bibtex\">year</span>   <span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-bibtex\">=</span> <span class=\"syntax-string syntax-quoted syntax-other syntax-braces syntax-bibtex\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-bibtex\">{</span>2026<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-bibtex\">}</span></span></span>,\n    <span class=\"syntax-meta syntax-key-assignment syntax-bibtex\"><span class=\"syntax-string syntax-unquoted syntax-key syntax-bibtex\">url</span>    <span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-bibtex\">=</span> <span class=\"syntax-string syntax-quoted syntax-other syntax-braces syntax-bibtex\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-bibtex\">{</span>https://qwen.ai/blog?id=qwen3.8-flash-next<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-bibtex\">}</span></span>\n</span><span class=\"syntax-punctuation syntax-section syntax-entry syntax-end syntax-bibtex\">}</span></span>\n</span></span></code></pre>\n<h1>References</h1>\n<p>[1] Gated Delta Networks: Improving Mamba2 with Delta Rule</p>\n<p>[2] DeepSeek-V3.2: Pushing the Frontier of Open Large Language Models</p>\n<p>[3] IndexCache: Accelerating Sparse Attention via Cross-Layer Index Reuse</p>\n<p>[4] Hyper-Connections</p>\n<p>[5] A Unified View of Attention and Residual Sinks: Outlier-Driven Rescaling is Essential for Transformer Training</p>\n<p>[6] Conditional Memory via Scalable Lookup: A New Axis of Sparsity for Large Language Models</p>\n<p>[7] Muon: An Optimizer for Hidden Layers in Neural Networks</p>\n<p>[8] Demons in the Detail: On Implementing Load Balancing Loss for Training Specialized Mixture-of-Expert Models</p>\n<p>[9] Gated Attention for Large Language Models: Non-linearity, Sparsity, and Attention-Sink-Free</p>\n",
  "content_markdown": "![Qwen3.8-Flash-Next](https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.8-Flash-Next/Qwen3.8-flash_banner_en.jpg#center)\n\n[HUGGING FACE](https://huggingface.co/Qwen/Qwen3.8-Flash-Next) [MODELSCOPE](https://modelscope.cn/models/Qwen/Qwen3.8-Flash-Next) [TECH REPORT](https://github.com/QwenLM/Qwen3.8-Flash-Next/blob/main/tech_report.pdf) [FLASHQLA](https://github.com/QwenLM/FlashQLA) [DISCORD](https://discord.gg/yPEP2vHTu4)\n\n## Introduction\n\nIn this release we are opening the weights of **Qwen3.8-Flash-Next**, a multimodal MoE model that also serves as an early preview of the architecture used in **Qwen4**. It plays the same role that [Qwen3-Next](https://qwen.ai/blog?id=qwen3-next) played for Qwen3.5: the hybrid **Gated DeltaNet + Gated Attention** design introduced at that time has since been used across the Qwen3.5, Qwen3.6, Qwen3.7 and Qwen3.8 series. We are again releasing the architectural changes early, so that the community can examine them before the full Qwen4 model family is built on top of them.\n\nQwen3.8-Flash-Next upgrades the model systematically along four aspects — **attention, residual, embedding and optimization** — improving model capability while further optimizing computational efficiency, model capacity and training stability:\n\n- **Attention**: A **GDN + QSA hybrid architecture**. Gated DeltaNet (GDN) compresses the history efficiently; **Qwen Sparse Attention (QSA)** uses a compressed lightweight indexer to select the important context at micro-block granularity, substantially reducing the cost of attention on long sequences.\n- **Residual**: **Gated Residual (GR)** widens the residual stream into 4 branches and controls reads and writes with a dynamic gate, strengthening cross-layer information flow and training stability.\n- **Embedding**: **N-gram Embedding** looks up a table using the local context to scale model capacity with very little extra computation; the embedding table can be offloaded to host memory and overlapped with model computation through asynchronous prefetching.\n- **Optimization**: The **Muon optimizer** is used, refined around orthogonalization accuracy, the division of labour between Muon and AdamW, and the splitting of fused parameters, with the scaling law refitted for the new architecture.\n\nQwen3.8-Flash-Next features a **125B**-parameter main model, supplemented by an additional **51B** N-gram embeddings, with **6B** parameters activated per token. Compared with Qwen3.7-Plus, Qwen3.8-Flash-Next substantially reduces both training and inference cost — training takes only about 1/9 as much, yet it delivers superior capabilities in coding and office tasks.\n\nIt natively supports **262,144** tokens of context and is extensible to **1,000,000** tokens with YaRN. For more technical details on the architecture, training methodology, and experimental analysis of Qwen3.8-Flash-Next, please refer to the [technical report](https://github.com/QwenLM/Qwen3.8-Flash-Next/blob/main/tech_report.pdf) in our GitHub repository.\n\nQwen3.8-Flash-Next weights are now available on [Hugging Face](https://huggingface.co/Qwen/Qwen3.8-Flash-Next) and [ModelScope](https://modelscope.cn/models/Qwen/Qwen3.8-Flash-Next). The production version, with 1M context by default and official built-in tools, is served as **Qwen3.8-Flash** on [QwenCloud](https://www.qwencloud.com/models/qwen3.8-flash), **priced at 0.15 USD per million input tokens and 0.47 USD per million output tokens**.\n\n## Performance\n\n### Language\n\n|                                                           | Qwen3.8-Flash-Next            | Qwen3.8-27B               | Qwen3.7-Plus              | DeepSeek-V4-Flash-0731      | Claude-Opus-4.6 (Max) |\n| --------------------------------------------------------- | ----------------------------- | ------------------------- | ------------------------- | --------------------------- | --------------------- |\n| \\# Params                                                 | 125B                          | 27B                       | 397B                      | 284B                        | --                    |\n| \\# Activated params                                       | 6B                            | 27B                       | 17B                       | 13B                         | --                    |\n| \\# N-gram embedding params                                | 51B                           | --                        | --                        | --                          | --                    |\n| Coding                                                    |                               |                           |                           |                             |                       |\n| Agentic coding  DeepSWE 1.1                               | **58.7**                      | 42.2                      | 16.5                      | 54.4                        | --                    |\n| Agentic coding  SWE-bench Pro                             | **62.5**                      | 61.7                      | 55.8                      | 56.0                        | 53.4                  |\n| Multilingual software engineering  SWE-bench Multilingual | **81.0**                      | 73.8                      | 75.8                      | --                          | 77.5                  |\n| Repo-level code generation  NL2Repo-Bench                 | 48.1                          | 42.3                      | 41.1                      | **54.2**                    | 47.6                  |\n| Agent                                                     |                               |                           |                           |                             |                       |\n| Long-horizon office work  CoWorkBench                     | **73.9**                      | 70.7                      | 65.1                      | 45.1                        | 68.2                  |\n| Professional job tasks  JobBench                          | **55.7**                      | 33.4                      | 27.6                      | 41.3                        | 36.6                  |\n| Frontier agentic tasks  Agents' Last Exam                 | Pass@1  24.3  Score  **51.2** | Pass@1  20.4  Score  42.9 | Pass@1  13.2  Score  33.6 | Pass@1  **25.2**  Score  -- | --                    |\n| Real-world tool use  Toolathlon Verified (Pass@1)         | **73.5**                      | 67.1                      | 50.6                      | 70.3                        | --                    |\n| General                                                   |                               |                           |                           |                             |                       |\n| Instruction following  IFBench                            | **81.3**                      | 79.5                      | 79.1                      | 79.2                        | 62.5                  |\n| Scientific reasoning  GPQA Diamond                        | **91.7**                      | 89.2                      | 90.3                      | 90.8                        | 91.3                  |\n| Multidisciplinary reasoning  HLE                          | 35.9                          | 30.8                      | 34.7                      | 33.8                        | **40.0**              |\n| Competitive coding  LiveCodeBench v6                      | **91.9**                      | 90.3                      | 89.6                      | 90.6                        | 88.8                  |\n\n1\\. DeepSWE 1.1: evaluated with the Claude Code and mini-SWE-agent harnesses, temp=1.0, top\\_p=0.95, 256K context window. We report the highest score across the two harnesses; notably, Qwen3.8-Flash-Next performs best on mini-SWE-agent.\\\n2\\. SWE-bench Pro: except for Claude-Opus-4.6 (Max), for which we report the officially published score, all models are evaluated with the Claude Code harness, temp=1.0, top\\_p=0.95, 256K context window. Problematic tasks were corrected and all baseline models were re-evaluated on the refined benchmark.\\\n3\\. SWE-bench Multilingual: evaluated with the mini-SWE-agent harness, temp=1.0, top\\_p=0.95, 256K context window.\\\n4\\. NL2Repo-Bench: evaluated with the Claude Code harness. To prevent reward hacking, we disable Bash commands that attempt to access the specific repository, such as pip download, pip install and git clone.\\\n5\\. CoWorkBench: an in-house cowork benchmark for evaluating long-horizon office and productivity agent tasks across computer science, finance, law, medical and other productivity domains.\\\n6\\. HLE: judged by GPT-4o.\\\n7\\. The best result in each row is shown in bold.\\\n8\\. Empty cells (--): scores are not yet available or are not applicable.\n\n### Vision Language\n\n|                                         | Qwen3.8-Flash-Next                      | Qwen3.8-27B                     | Qwen3.7-Plus                        | Claude-Opus-4.6 (Max)       |\n| --------------------------------------- | --------------------------------------- | ------------------------------- | ----------------------------------- | --------------------------- |\n| Agentic Multimodal Intelligence         |                                         |                                 |                                     |                             |\n| Multimodal tool use  ClawEval-MM        | Pass@3  **64.4**  Average  **60.4**     | Pass@3  57.4  Average  56.9     | Pass@3  57.4  Average  60.1         | Pass@3  52.5  Average  54.7 |\n| Application recreation  RecreationBench | **49.9**                                | 47.1                            | 30.2                                | --                          |\n| Mobile use  AndroidWorld                | **84.5**                                | 81.9                            | 81.0                                | 62.0                        |\n| Computer use  OSWorld 2.0               | Binary  **19.4**  Partial  **52.3**     | Binary  19.4  Partial  48.0     | Binary  2.8  Partial  21.5          | --                          |\n| Visual web development  Vision2Web      | **64.0**                                | 62.9                            | 42.1                                | --                          |\n| General Multimodal Intelligence         |                                         |                                 |                                     |                             |\n| Embodied intelligence  ERQA             | **72.3**                                | 65.5                            | 69.8                                | 40.8                        |\n| Long video understanding  LVBench       | **76.6**                                | 72.4                            | 76.2                                | 63.0                        |\n| Real-world perception  RealWorldQA      | **88.5**                                | 85.9                            | 86.9                                | 73.9                        |\n| Visual math problem solving  MathVision | Without CI  **90.6**  With CI  **95.7** | Without CI  90.0  With CI  94.6 | Without CI  90.3  With CI  88.7     | Without CI  65.5            |\n| Scientific chart analysis  CharXiv (RQ) | Without CI  84.6  With CI  **90.6**     | Without CI  83.7  With CI  90.2 | Without CI  **85.8**  With CI  85.9 | Without CI  66.0            |\n\n1\\. ClawEval-MM: scores are reported as \"pass@3 / average score\". Pass@3 measures the percentage passed in at least one of three trials, and the average score is the mean score across the three trials.\\\n2\\. RecreationBench: an in-house long-horizon application-recreation benchmark for evaluating hybrid-agent abilities spanning five platforms — desktop (Ubuntu, macOS, Windows), mobile (Android) and web.\\\n3\\. OSWorld 2.0: scores are reported as \"binary / partial\". The binary score is the percentage of tasks that receive the full task reward, while the partial score aggregates the partial rewards obtained across all tasks.\\\n4\\. Vision2Web: scores are reported as the average over the frontend, webpage and website categories, using the Claude Code harness and judged by gpt-5.4-2026-03-05.\\\n5\\. MathVision, CharXiv (RQ): scores are reported as \"without CI / with CI\". A small number of incorrect ground-truth annotations in MathVision were corrected after manual verification. Our model's score is evaluated using a fixed prompt, e.g. \"Please reason step by step, and put your final answer within \\\\boxed{}.\" For other models, we report the higher score between runs with and without the \\\\boxed{} formatting.\\\n6\\. The best result in each row is shown in bold.\\\n7\\. Empty cells (--) indicate scores not yet available or not applicable.\n\n## Model Architecture\n\n![Qwen3.8-Flash-Next architecture](https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.8-Flash-Next/architecture.png#center)\n\n### Attention: GDN + QSA for Efficient Memory and Precise Retrieval\n\nTraditional Full Attention provides direct access to all previous tokens, but as the context grows longer, both computation and KV Cache memory-access costs increase substantially.\n\nFollowing the architecture design introduced in Qwen3.5, Qwen3.8-Flash-Next adopts a **GDN [\\[1\\]](https://qwen.ai/blog/qwen3.8-flash-next/#ref1) + Attention Hybrid architecture**: three out of every four layers use Gated DeltaNet (GDN) to continuously compress historical information into a fixed-size state, while the remaining layer uses global Attention for precise retrieval of information across the full context.\n\nFor global Attention, we further introduce **Qwen Sparse Attention (QSA)**. Sparse Attention reduces long-sequence computation by attending only to important context. However, existing approaches such as DSA [\\[2\\]](https://qwen.ai/blog/qwen3.8-flash-next/#ref2) still rely on a token-level indexer to identify important positions; as the context grows, the indexer itself becomes a non-negligible source of computation.\n\nQSA further compresses this process: a lightweight indexer first aggregates the sequence into **micro-blocks**, estimates context importance at the block level, and then selects the most relevant regions for Attention. This reduces not only the cost of Attention itself, but also the indexing overhead required to identify important context. Compared with approaches that share indices across layers [\\[3\\]](https://qwen.ai/blog/qwen3.8-flash-next/#ref3), QSA performs sequence compression independently within each layer, reducing its dependence on cross-layer Attention similarity and making it particularly well suited to Hybrid architectures where GDN and Attention layers are interleaved.\n\n![Overview of Qwen Sparse Attention (QSA)](https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.8-Flash-Next/qsa_arch.png#center)\n\nPut simply: **GDN efficiently “remembers,” while QSA precisely “retrieves.”**\n\nAt **1M tokens**, QSA’s Attention Kernel achieves up to **7.6×** and **4.9×** speedups in Prefill and Decode, respectively. In an experimental setup representative of online serving scenarios with high cache reuse (a **90% Prefix Cache hit rate**), Qwen3.8-Flash-Next achieves **8.6×** the Prefill throughput of Qwen3.7-Plus at a **1M-token context length**.\n\n![Relative prefill throughput at 90% cache hit rate](https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.8-Flash-Next/throughput.png#center)\n\n### Gated Residual: More Paths for Information Flow\n\nIn a traditional Transformer, all layers continuously read from and write to the same Residual Stream. As the network becomes deeper, early features are repeatedly mixed with later information, making important signals more likely to be gradually diluted.\n\n**Gated Residual (GR)** can be viewed as a combination of two ideas: it follows **Hyper-Connection** [\\[4\\]](https://qwen.ai/blog/qwen3.8-flash-next/#ref4) in widening the residual stream into multiple branches, while incorporating the element-wise dynamic gating of **GatedNorm** [\\[5\\]](https://qwen.ai/blog/qwen3.8-flash-next/#ref5) into the residual read. The original single residual stream is expanded into four parallel branches, allowing the model to dynamically determine how much information to read from each branch and how much to write back to each branch based on the current content.\n\nThis can be conceptualized as expanding a single information channel into multiple parallel pathways: some branches handle local information flow, while others preserve early information directly deep into the network layers. Empirical analysis also reveals that one of these branches naturally emerges as a long-range pathway connecting the first Attention layer to most of the middle and subsequent layers.\n\nGR also further simplifies Hyper-Connection. Once the read and write operations are expressive enough, additional branch mixing yields no significant benefits and can thus be directly removed, thereby reducing memory access overhead and sources of instability. The Gate also effectively suppresses **activation outliers** and improves training stability. In addition, the Residual State supports **FP8** storage, further reducing memory-access overhead.\n\n### N-gram Embedding: Expanding Model Capacity at Low Cost\n\nInspired by Per-Layer Embedding in Gemma 3n and works such as DeepSeek Engram [\\[6\\]](https://qwen.ai/blog/qwen3.8-flash-next/#ref6), we further introduce **N-gram Embedding** to scale model capacity beyond the parameters of the Transformer backbone.\n\nA standard Embedding performs a lookup based on a single token. N-gram Embedding instead performs lookups using the local context formed by the current token and several preceding tokens, providing additional representations for common phrases and local patterns.\n\nIts key advantage is that it **can add a large number of parameters with almost no additional computation per token**.\n\nQwen3.8-Flash-Next introduces an additional **51B N-gram Embedding parameters**. Because lookup locations can be determined in advance, these parameters can be stored in Host Memory and asynchronously prefetched in parallel with model computation, without permanently occupying GPU memory.\n\nThe final model uses only a single N-gram Embedding layer near the beginning of the network, effectively adding a large-scale **“local-pattern memory”** at relatively low additional cost.\n\n### Optimization: Co-designing Architecture and Optimization\n\nQwen3.8-Flash-Next is trained with the **Muon Optimizer** [\\[7\\]](https://qwen.ai/blog/qwen3.8-flash-next/#ref7), with further improvements around three key aspects of applying Muon to large-scale model training: **orthogonalization accuracy, parameter assignment between Muon and AdamW, and splitting fused parameter matrices**.\n\nFor parameters that genuinely act as two-dimensional linear maps, such as the main weights in Attention, GDN, and MoE Experts, we use Muon. Embeddings, the MoE Router, and the low-rank parameters in GR continue to use AdamW. For QKV, SwiGLU, and GDN projections that are fused in the implementation, we first split them according to the independent linear transformations they represent, and then perform orthogonalization separately.\n\nFor the new architecture and Optimizer, we refit the Scaling Law. The results show that the model can stably use **larger Learning Rates and Batch Sizes**, further improving convergence efficiency and large-scale parallel training throughput.\n\nWe also find that **Batch Size Warmup**, a common practice in large-scale model training, is no longer necessary: gradually increasing from a small Batch to the target Batch does not improve the final result, but instead requires **18.8% more optimizer steps**. In the final training Recipe, we therefore start directly with the target Batch Size.\n\n### Other Architecture Optimizations\n\nThe remaining components follow the design established in Qwen3-Next and refined through the Qwen3.5–Qwen3.8 series.\n\n- **Ultra-sparse MoE**: With global load balancing [\\[8\\]](https://qwen.ai/blog/qwen3.8-flash-next/#ref8), increasing total expert parameters while keeping the number of activated experts fixed steadily reduces training loss. Qwen3.8-Flash-Next therefore uses a large expert pool with a small number of routed experts per token, together with one shared expert.\n- **Multi-Token Prediction**: The MTP module is trained with multiple steps, maintaining consistency between training and inference and thereby improving the acceptance rate of speculative decoding in real scenarios, while also enhancing the performance of the backbone. Its full-attention layers are replaced with QSA as well.\n- **Training stability**: Zero-centered RMSNorm with weight decay applied to norm weights, the attention output gating mechanism [\\[9\\]](https://qwen.ai/blog/qwen3.8-flash-next/#ref9), and normalized MoE router initialization are retained. These designs make small-scale ablations more reliable and help large-scale training run smoothly.\n\n## Base Model Performance\n\nWe compare Qwen3.8-Flash-Next-Base with the base models of Qwen3.8-27B and Qwen3.7-Plus.\n\n|                            | Qwen3.8-Flash-Next-Base | Qwen3.8-27B-Base | Qwen3.7-Plus-Base |\n| -------------------------- | ----------------------- | ---------------- | ----------------- |\n| \\# Params                  | 125B                    | 27B              | 397B              |\n| \\# Activated params        | 6B                      | 27B              | 17B               |\n| \\# N-gram embedding params | 51B                     | --               | --                |\n| General tasks              |                         |                  |                   |\n| MMLU                       | 90.36                   | 87.51            | **90.43**         |\n| MMLU-Redux                 | 90.68                   | 87.26            | **91.47**         |\n| MMLU-Pro                   | **73.23**               | 68.60            | 70.90             |\n| SuperGPQA                  | **51.36**               | 44.86            | 48.42             |\n| BBH                        | **90.87**               | 89.56            | 89.41             |\n| Math & STEM tasks          |                         |                  |                   |\n| GPQA                       | 51.42                   | 45.01            | **51.52**         |\n| GSM8K                      | **93.29**               | 93.18            | 92.95             |\n| MATH                       | 72.78                   | 60.54            | **74.38**         |\n| Coding tasks               |                         |                  |                   |\n| EvalPlus                   | **78.76**               | 76.05            | 78.06             |\n| MultiPL-E                  | 79.09                   | 74.50            | **81.68**         |\n| SWEBench-Pretrain          | **50.99**               | 41.66            | 49.24             |\n| Multilingual tasks         |                         |                  |                   |\n| MGSM                       | **89.33**               | 86.37            | 85.42             |\n| MMMLU                      | **84.86**               | 79.74            | 84.53             |\n| INCLUDE                    | 78.40                   | 74.37            | **78.90**         |\n\n1\\. The best result in each row is shown in bold.\\\n2\\. Empty cells (--): scores are not yet available or not applicable.\n\nWith 6B activated parameters, Qwen3.8-Flash-Next-Base achieves the best result on 8 of the 14 benchmarks, including MMLU-Pro, SuperGPQA, BBH, GSM8K, EvalPlus, SWEBench-Pretrain, MGSM and MMMLU, and remains close to Qwen3.7-Plus-Base on MMLU, MMLU-Redux, GPQA, MATH and MultiPL-E. The 51B N-gram embedding parameters are deterministically addressed and do not enter the per-token matrix-multiplication budget.\n\n## Develop with Qwen3.8-Flash-Next\n\nQwen3.8-Flash-Next is available as an open-weight model on [HuggingFace](https://huggingface.co/collections/Qwen/qwen38-flash-next) and [ModelScope](https://www.modelscope.cn/collections/Qwen/Qwen38-Flash-Next), with official managed APIs on [QwenCloud](https://www.qwencloud.com/models/qwen3.8-flash). Designed to balance capability, latency, and cost, it is well suited for high-volume applications, tool-driven workflows, and coding & coworking assistants. In the following, you can explore how to call the QwenCloud API and integrate Qwen3.8-Flash-Next into agentic systems and coding assistants.\n\n### API Usage\n\nQwen3.8-Flash-Next is available via API:\n\n#### QwenCloud\n\nOn [QwenCloud](https://www.qwencloud.com), the model is served under the name [`qwen3.8-flash`](https://www.qwencloud.com/models/qwen3.8-flash). QwenCloud supports industry-standard protocols, including OpenAI-compatible Chat Completions and Responses APIs, alongside an Anthropic-compatible interface.\n\n```python\n\"\"\"\nEnvironment variables:\n  DASHSCOPE_API_KEY: Your API Key from https://home.qwencloud.com/\n  DASHSCOPE_BASE_URL: (optional) Base URL for compatible-mode API.\n    - Beijing: https://dashscope.aliyuncs.com/compatible-mode/v1\n    - Singapore: https://dashscope-intl.aliyuncs.com/compatible-mode/v1\n    - US (Virginia): https://dashscope-us.aliyuncs.com/compatible-mode/v1\n\"\"\"\nfrom openai import OpenAI\nimport os\n\napi_key = os.environ.get(\"DASHSCOPE_API_KEY\")\nif not api_key:\n    raise ValueError(\n        \"DASHSCOPE_API_KEY is required. \"\n        \"Set it via: export DASHSCOPE_API_KEY='your-api-key'\"\n    )\n\nclient = OpenAI(\n    api_key=api_key,\n    base_url=os.environ.get(\n        \"DASHSCOPE_BASE_URL\",\n        \"https://dashscope-intl.aliyuncs.com/compatible-mode/v1\",\n    ),\n)\n\nmessages = [{\"role\": \"user\", \"content\": \"Write a Python function to merge two sorted linked lists.\"}]\n\ncompletion = client.chat.completions.create(\n    model=\"qwen3.8-flash\",\n    messages=messages,\n    extra_body={\n        \"enable_thinking\": True,\n        # \"preserve_thinking\": True,\n    },\n    reasoning_effort=\"xhigh\",  # supported levels are xhigh, medium, and low\n    stream=True,\n)\n\nreasoning_content = \"\"\nanswer_content = \"\"\nis_answering = False\nprint(\"\\n\" + \"=\" * 20 + \"Reasoning\" + \"=\" * 20 + \"\\n\")\n\nfor chunk in completion:\n    if not chunk.choices:\n        print(\"\\nUsage:\")\n        print(chunk.usage)\n        continue\n\n    delta = chunk.choices[0].delta\n\n    if hasattr(delta, \"reasoning_content\") and delta.reasoning_content is not None:\n        if not is_answering:\n            print(delta.reasoning_content, end=\"\", flush=True)\n        reasoning_content += delta.reasoning_content\n\n    if hasattr(delta, \"content\") and delta.content:\n        if not is_answering:\n            print(\"\\n\" + \"=\" * 20 + \"Answer\" + \"=\" * 20 + \"\\n\")\n            is_answering = True\n        print(delta.content, end=\"\", flush=True)\n        answer_content += delta.content\n```\n\n### Agent Frameworks & Coding Assistants\n\nQwen3.8-Flash-Next integrates seamlessly with popular agent frameworks and coding assistants:\n\n#### QwenWork\n\n[QwenWork](https://qwenwork.ai) is Alibaba’s flagship AI productivity platform, designed to help individuals and enterprises automate daily tasks and accelerate operational efficiency.\n\nWe are excited to share that QwenWork has integrated **Qwen3.8-Flash-Next** to power its newly launched “Standard” mode, leveraging the model’s cutting-edge capabilities to deliver a seamless, cost-effective experience that sets a new standard for AI agents in the workplace.\n\n![Qwen3.8-Flash on QwenWork](https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.8-Flash-Next/qwen-work-ai.png#center)\n\nLearn more in the [official documentation](https://docs.qwenwork.ai/product-introduction)!\n\n#### Claude Code\n\nQwen APIs support the Anthropic API protocol, enabling direct use with **Claude Code**:\n\n```bash\nnpm install -g @anthropic-ai/claude-code\n\nexport ANTHROPIC_MODEL=\"qwen3.8-flash\"\nexport ANTHROPIC_SMALL_FAST_MODEL=\"qwen3.8-flash\"\nexport ANTHROPIC_BASE_URL=https://dashscope-intl.aliyuncs.com/apps/anthropic\nexport ANTHROPIC_AUTH_TOKEN=<your_api_key>\n\nclaude\n```\n\n#### Codex\n\nQwen APIs support the OpenAI Responses protocol, enabling use with **Codex**:\n\nIn `~/.codex/model-catalog.local.json`\n\n```json\n{\n  \"models\": [\n    {\n      \"slug\": \"qwen3.8-flash\",\n      \"display_name\": \"qwen3.8-flash\",\n      \"description\": \"QwenCloud: Qwen3.8-Flash\",\n      \"default_reasoning_level\": \"xhigh\",\n      \"supported_reasoning_levels\": [\n        {\n          \"effort\": \"low\",\n          \"description\": \"Fast responses with lighter reasoning\"\n        },\n        {\n          \"effort\": \"medium\",\n          \"description\": \"Greater reasoning depth for complex problems\"\n        },\n        {\n          \"effort\": \"xhigh\",\n          \"description\": \"Extra high reasoning depth for complex problems\"\n        }\n      ],\n      \"context_window\": 1000000,\n      \"effective_context_window_percent\": 95,\n      \"supports_parallel_tool_calls\": true,\n      \"supports_image_detail_original\": true,\n      \"input_modalities\": [\"text\", \"image\"],\n      \"shell_type\": \"default\",\n      \"visibility\": \"list\",\n      \"supported_in_api\": true,\n      \"priority\": 1,\n      \"base_instructions\": \"\",\n      \"support_verbosity\": false,\n      \"supports_reasoning_summaries\": false,\n      \"experimental_supported_tools\": [],\n      \"truncation_policy\": {\n        \"mode\": \"bytes\",\n        \"limit\": 10000\n      }\n    }\n  ]\n}\n```\n\nIn `~/.codex/config.toml`\n\n```toml\nmodel_catalog_json = \"~/.codex/model-catalog.local.json\"\n\nmodel_provider = \"QwenCloud\"\nmodel = \"qwen3.8-flash\"\n\n[model_providers.QwenCloud]\nname = \"QwenCloud\"\nbase_url = \"https://dashscope-intl.aliyuncs.com/compatible-mode/v1\"\nenv_key = \"OPENAI_API_KEY\"\nwire_api = \"responses\"\n```\n\n```bash\nnpm install -g @openai/codex\n\nexport OPENAI_API_KEY=<your_api_key>\n\ncodex\n```\n\n#### Qoder CLI\n\n[Qoder](https://qoder.com/) co-evolves with Qwen for agentic coding:\n\n```bash\ncurl -fsSL https://qoder.com/install | bash\n\nqoder\n```\n\n#### Qwen Code\n\n[Qwen Code](https://qwen.ai/qwencode) is deeply optimized for the Qwen series:\n\n```bash\nnpm install -g @qwen-code/qwen-code@latest\n\nqwen\n```\n\n#### OpenClaw\n\nConnect to [OpenClaw](https://openclaw.ai) via [QwenCloud](https://docs.qwencloud.com/developer-guides/clients-and-developer-tools/openclaw):\n\n```bash\ncurl -fsSL https://openclaw.ai/install.sh | bash\n\nexport DASHSCOPE_API_KEY=<your_api_key>\n\nopenclaw dashboard\n```\n\nConfigure `~/.openclaw/openclaw.json`:\n\n```json\n{\n  \"models\": {\n    \"mode\": \"merge\",\n    \"providers\": {\n      \"qwencloud\": {\n        \"baseUrl\": \"https://dashscope-intl.aliyuncs.com/compatible-mode/v1\",\n        \"apiKey\": \"DASHSCOPE_API_KEY\",\n        \"api\": \"openai-completions\",\n        \"models\": [\n          {\n            \"id\": \"qwen3.8-flash\",\n            \"name\": \"qwen3.8-flash\",\n            \"reasoning\": true,\n            \"input\": [\"text\", \"image\"],\n            \"contextWindow\": 1000000,\n            \"maxTokens\": 65536\n          }\n        ]\n      }\n    }\n  },\n  \"agents\": {\n    \"defaults\": {\n      \"model\": {\n        \"primary\": \"qwencloud/qwen3.8-flash\"\n      }\n    }\n  }\n}\n```\n\n## Summary\n\nQwen3.8-Flash-Next extends the hybrid architecture introduced in Qwen3-Next along four directions: attention, residual, embedding and optimization. QSA compresses the sequence into micro-blocks within each layer, reducing both the attention cost and the indexing cost at long context while keeping precise retrieval. Gated Residual widens the residual stream into several parallel branches and controls reads and writes with an elementwise, data-dependent gate, improving cross-layer information flow and training stability at negligible arithmetic cost; the residual state can additionally be kept in FP8, which further reduces memory traffic. N-gram embedding scales capacity through deterministically addressed lookup memory, which can be scaled with negligible per-token computation and offloaded to host memory. On the optimization side, Muon is used as the main optimizer, with orthogonalization accuracy, parameter assignment and fused-matrix splitting as the decisive implementation choices, and the scaling law refitted for the new architecture.\n\nWe release these weights early so that the architecture can be evaluated independently by the community, as we did with Qwen3-Next, and we will continue to refine it towards Qwen4.\n\n## Citation\n\n```bibtex\n@techreport{qwen2026design,\n    title       = {On the Design of {Qwen3.8-Next} Architecture: Evaluation, Efficiency, and Training Stability},\n    author      = {{Qwen Team}},\n    institution = {Alibaba Group},\n    month       = {August},\n    year        = {2026}\n}\n\n@misc{qwen3.8flashnext,\n    title  = {{Qwen3.8-Flash-Next}: A New Architecture, Towards Ultimate Cost-Efficiency},\n    author = {{Qwen Team}},\n    month  = {August},\n    year   = {2026},\n    url    = {https://qwen.ai/blog?id=qwen3.8-flash-next}\n}\n```\n\n# References\n\n\\[1\\] Gated Delta Networks: Improving Mamba2 with Delta Rule\n\n\\[2\\] DeepSeek-V3.2: Pushing the Frontier of Open Large Language Models\n\n\\[3\\] IndexCache: Accelerating Sparse Attention via Cross-Layer Index Reuse\n\n\\[4\\] Hyper-Connections\n\n\\[5\\] A Unified View of Attention and Residual Sinks: Outlier-Driven Rescaling is Essential for Transformer Training\n\n\\[6\\] Conditional Memory via Scalable Lookup: A New Axis of Sparsity for Large Language Models\n\n\\[7\\] Muon: An Optimizer for Hidden Layers in Neural Networks\n\n\\[8\\] Demons in the Detail: On Implementing Load Balancing Loss for Training Specialized Mixture-of-Expert Models\n\n\\[9\\] Gated Attention for Large Language Models: Non-linearity, Sparsity, and Attention-Sink-Free\n",
  "dateCreated": "2026-10-19T01:26:53.998049939+00:00",
  "date_created": "2026-08-26T12:30:00+00:00",
  "date_modified": null,
  "date_published": "2026-08-26T12:30:00+00:00",
  "description": "HUGGING FACE MODELSCOPE TECH REPORT FLASHQLA DISCORD Introduction In this release we are opening the weights of Qwen3.8-Flash-Next, a multimodal MoE model that also serves as an early preview of the architecture used in Qwen4. It plays the…",
  "external_url": "https://qwen.ai/blog?id=qwen3.8-flash-next",
  "git": {
    "commit": "ebb0941c5c06a2ab2377342d607535262a3e969e",
    "path": "items/qwen-ai/2026/08/2026-08-26-qwen3-8-flash-next-a-new-architecture-towards-ultimate-cost.md",
    "permalink": "https://github.com/aymericbeaumet/aggr-instance/blob/ebb0941c5c06a2ab2377342d607535262a3e969e/items/qwen-ai/2026/08/2026-08-26-qwen3-8-flash-next-a-new-architecture-towards-ultimate-cost.md"
  },
  "id": "urn:aggr:item:8a6057a8cf7d2b92eabe480c0bb4930b5a0f2699",
  "isBasedOn": {
    "@id": "https://qwen.ai/blog?id=qwen3.8-flash-next"
  },
  "mainEntity": {
    "@id": "https://qwen.ai/blog?id=qwen3.8-flash-next",
    "@type": "CreativeWork",
    "archivedAt": {
      "@id": "https://aggr.aymericbeaumet.com/items/qwen-ai/2026-08-26-qwen3-8-flash-next-a-new-architecture-towards-ultimate-cost/#webpage"
    },
    "author": [
      {
        "@type": "Person",
        "name": "QwenTeam"
      }
    ],
    "datePublished": "2026-08-26T12:30:00+00:00",
    "headline": "Qwen3.8-Flash-Next: A New Architecture, Towards Ultimate Cost-Efficiency",
    "image": {
      "@type": "ImageObject",
      "caption": null,
      "height": 90,
      "url": "https://img.alicdn.com/imgextra/i1/O1CN01ZxcR5nZsP9E3E9bs_!!6000000003536-2-tps-1590-954.png",
      "width": 160
    },
    "timeRequired": "PT16M",
    "url": "https://qwen.ai/blog?id=qwen3.8-flash-next",
    "wordCount": 3383
  },
  "name": "Archived snapshot: Qwen3.8-Flash-Next: A New Architecture, Towards Ultimate Cost-Efficiency",
  "preview": {
    "alt": null,
    "color": null,
    "height": 90,
    "placeholder": {
      "data_url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=",
      "hash": ""
    },
    "url": "https://img.alicdn.com/imgextra/i1/O1CN01ZxcR5nZsP9E3E9bs_!!6000000003536-2-tps-1590-954.png",
    "width": 160
  },
  "reading_minutes": 16,
  "replicated_at": null,
  "source": "qwen-ai",
  "source_name": "Qwen",
  "summary": null,
  "tags": [
    "open-source"
  ],
  "temporalCoverage": "2026-10-19T01:26:53.998049939+00:00",
  "title": "Qwen3.8-Flash-Next: A New Architecture, Towards Ultimate Cost-Efficiency",
  "url": "https://aggr.aymericbeaumet.com/items/qwen-ai/2026-08-26-qwen3-8-flash-next-a-new-architecture-towards-ultimate-cost/",
  "word_count": 3383
}