Qwen4 Max Lands on Together AI, Fixes Entire Tornado Repo Bug in a Single Call
Alibaba's flagship model pinpoints and patches an open-source framework defect in one shot with a 650K-token context, at roughly 69 cents per request

Table of Contents (4)
Key Takeaways (TL;DR)
- 01Qwen4 Max is live on Together AI's serverless inference platform under the model string Qwen/Qwen4-Max, supports a 1M-token context, and is 30% off through November 22, 2026.
- 02In a hands-on test, all 344 Tornado files totaling 652,519 tokens were fed in at once; the model located an exception-handling defect in websocket.py and produced a patch within 72 seconds.
- 03The patch passed two regression tests added by Tornado's maintainer and failed none of the full suite of 1,673 tests; with cache hits, repeat requests cut input cost to about 3 cents.
Together AI has disclosed that Alibaba's flagship model Qwen4 Max is now available on its serverless inference platform, and that it fixed a Tornado framework bug with a single 650K-token whole-repository request. The model returned a patch within 72 seconds with no tools and no retrieval, and the patch passed regression tests written by the maintainer. The request cost about 69 cents.
Swallowing the Whole Repo in One Call: The Design of the 650K-Token Test
Together AI published a hands-on test of long-context coding capability on its research and product blog. The subject was Tornado, an open-source Python web framework whose codebase contains roughly 340 code, test, and documentation files. The team fed all 344 text files in the checked-out directory into a single prompt—652,519 tokens in total—without pre-filtering relevant files, without running a retrieval step, and without giving the model any tools.
The defect chosen for the test was one that Tornado's maintainer fixed in a commit on November 18, 2026; the test baseline was the code state before that commit. The bug lives in the websocket code: when a connection closes while messages are still unsent, every write_message() call that is not awaited logs "Task exception was never retrieved" at ERROR level, even though awaiting the Future returned by the call is optional.
The first token arrived after 54 seconds and the full response finished at 72 seconds; the request cost about 69 cents at the discounted rate.
- Input was all 344 Tornado text files, totaling 652,519 tokens, completed in a single request.
- The prompt described only the symptoms; it did not name the file location or provide any retrieval or tool assistance.
- The test baseline was locked to the code state before the maintainer's fix commit to ensure comparability.
Defect Symptoms and Prompt Construction
The bug report the team submitted described only the observable phenomenon: when a websocket connection closes before messages have finished sending—for example, when a client sends a message and a FIN without reading the reply, or resets the connection outright—every write_message() call that is not awaited logs the error above. The report also made clear that awaiting the call is optional, that un-awaited calls should produce no log output, and that callers who do await should still receive WebSocketClosedError.
The prompt was deliberately stripped of localization clues, forcing the model to determine on its own where the problem lay within the full codebase. Together AI said the aim was to show what a single call can accomplish and what it costs, not to build a reusable defect-fixing pipeline.
Patch Quality: Accurate Localization and an In-Repo Precedent
The model traced the error to the WebSocketProtocol13.write_message method in tornado/websocket.py. That method wraps each write in a task; when the connection closes, the task fails with an exception, and Python logs it because no one collects the exception. The model's patch marks the exception as retrieved so the log no longer appears, while preserving the path by which awaiting callers receive the error.
More notable is how the patch was written. In its explanation, the model noted that the fix should follow the existing handling of the Future in BaseIOStream.write, a method one layer down in tornado/iostream.py that solves the same class of problem. The bug report never mentioned that file, yet the model found the precedent on its own within the repository—and Tornado's maintainer made the same analogy in the fix commit.
All 344 files were fed in together, and the model found the two files that actually mattered on its own.
- The patch uses add_done_callback to collect the exception when the task completes, so un-awaited calls no longer produce log output.
- Callers that await the write still receive WebSocketClosedError; behavioral semantics are unchanged.
- The model proactively cited the analogous handling in tornado/iostream.py as justification, matching the maintainer's approach.
Verification Method and Test Results
In the fix, Tornado's maintainer added two regression tests, covering un-awaited writes and awaited writes respectively. On the pre-fix code, the first test fails; with the model's patch applied, both tests pass. The team then ran Tornado's full test suite with the patch in place—1,673 tests in all—with no failures.
Together AI stressed that this is a single curated example illustrating what one call can do and what it costs, and does not constitute a general conclusion about the model's performance on arbitrary codebases.
Pricing, Caching, and Model Specs
At the discounted rate, the request cost about 69 cents, almost entirely from the 652,519 input tokens; at list price it would be 98 cents. Together AI automatically enables caching for prompt input, with cached input priced at $0.0525 per million tokens during the promotional period. When the team re-sent the roughly 630K-token request, the vast majority of input hit the cache, cutting time to first token from 54 seconds to 8 seconds and input cost from about 66 cents to about 3 cents.
Qwen4 Max was released by Alibaba on November 16, 2026, and is described as the most capable model in the Qwen series to date, positioned for long-horizon agentic work including programming tasks across large codebases. It uses a sparse mixture-of-experts architecture with 2.4 trillion total parameters and 71 billion activated per token.
The benchmark figures above are all Alibaba's own published data; its release announcement contains the details.
- The model string is Qwen/Qwen4-Max, offered through Together Serverless Inference with a 1M-token context.
- It is 30% off through November 22, 2026, with cached input priced at $0.0525 per million tokens.
- Alibaba says it outperforms Qwen3.8 Max overall on its in-house Work360 benchmark, uses 35% fewer tokens at high reasoning effort, and cuts average cost per task by about 60%.
How to Call It and What to Watch For
Together AI also provided a sample script: using the Together Python SDK and an API key, it reads all git-tracked text files in a local repository and sends them together with the bug report as a single request, streaming the output. The script places the model's reasoning and final answer in the delta.reasoning and delta.content fields respectively.
The platform cautions that the example sends every tracked text file in the repository, so users should check whether their codebase contains secrets or other sensitive information before running it.
Implications for the Long-Context Coding Approach
The core significance of this test is that it validates a path different from retrieval augmentation: place the entire codebase directly in the context window and let the model judge relevance itself. At Tornado's scale, this path eliminates file filtering and the retrieval pipeline, produces a merge-quality patch in a single call, and keeps costs in an accountable range.
That said, 344 files and 650K tokens remain far below the 1M-token ceiling, and there is no public data on whether larger repositories can be handled the same way. Caching significantly lowers the input overhead of repeat requests, which has real value for agentic coding workflows that need to read the same codebase repeatedly.
Together AI explicitly states that the test is only an example demonstrating the capability and cost of a single call.
- Whole-repo context eliminates the retrieval step, but input token volume directly determines per-call cost.
- Automatic caching sharply reduces time to first token and input cost for repeat requests.
- A single example is not enough to infer how well the model generalizes to other codebases.
Impact
Industry Impact & Strategic Takeaways
For the Asia-Pacific AI industry, this test provides a cost and quality sample of a long-context model on a real open-source repository: whole-repo input combined with automatic caching brings the per-call overhead of agentic coding into an accountable range. For inference platforms, cache pricing and time to first token are becoming key competitive battlegrounds for handling large-codebase workflows; for model vendors, whether a model can locate relevant files on its own without retrieval is becoming a concrete measure of long-context capability. A single case is not yet enough to support general conclusions.
Frequently Asked Questions
What is the model string for Qwen4 Max on Together AI, and how long a context does it support?
+
The model string is Qwen/Qwen4-Max, offered through Together Serverless Inference with a 1M-token context, and it is 30% off through November 22, 2026.
What did the whole-repo Tornado fix test cost?
+
At the discounted rate, a single request cost about 69 cents, almost entirely from the 652,519 input tokens; at list price it would be about 98 cents. With cache hits on repeat requests, input cost can drop to about 3 cents.
Was the patch the model produced verified?
+
The patch passed the two regression tests Tornado's maintainer added for the defect and failed none of Tornado's full suite of 1,673 tests.
Primary Source & Attribution
Together AI 研究与产品博客(RSS)
Qwen4 Max is live on Together AI
Related Deep Dives

Google Launches Tool Retrieval Preview in Gemini API: On-Demand Tool Schema Loading Solves Agent Scaling Challenges
62 pts · 6 min read

Qwen App Opens Qwen Go Call Service for Free, Allowing Authorized AI to Place Calls and Schedule Callbacks
72 pts · 5 min read

Anthropic Launches Install as app for Claude Desktop, Turning Artifacts into Mac and Windows Applications
77 pts · 5 min read

Tencent's Open-Source Hy4 Flash Lands on Fireworks Serverless, Targeting Low-Cost Specialized Tasks
75 pts · 5 min read