HomeArticle

With Claude's self-built reasoning engine, the latency before the AI returns the first character is slashed from 12 seconds to half a second.

新智元2026-11-20 07:42
Claude has developed its own reasoning engine! The latency for the AI to output the first character is reduced from 12 seconds to only 0.5 seconds.

You ask an AI to help fix a login error.

After modifying the code following its suggestions, you rerun the login test. A line of red text pops up in the terminal, reporting the exact same error.

You paste the new log into the dialog box, press Enter, and wait for the AI to tell you where to check next.

Fixing a bug often requires several rounds of back-and-forth like this.

After submitting a problem each time, how long do you have to wait before seeing the first word returned by the AI?

Recently, a test was conducted using real programming sessions, and Claude directly cut the waiting time from about 12 seconds to half a second.

On November 12, researchers from institutions including Carnegie Mellon University and NVIDIA submitted the preprint *Singularity-Bench: Can Agents Build Agents?*.

For one of the tasks, the researchers gave Claude Opus 5.5 a basic server codebase, 4 GB300 GPUs and 12 hours of runtime.

During the task, the development environment was restricted from accessing the internet for reference. Claude needed to use Claude Code to write a complete inference engine, which is responsible for receiving user requests, scheduling GPUs to run the model, and sending the generated responses back.

After the engine was written, the researchers did not only review the code, but directly tested its performance with real programming sessions.

They had two engines run the same model on 4 GB300 GPUs respectively, and replayed the same batch of 16 concurrent real programming sessions.

The measured metric is called P90 time to first token latency:

Sort the waiting time from when all requests are sent to when the model starts to respond, and the value at the 90th percentile is the P90 latency. In other words, 90% of the requests can get a response start within this time frame.

As a result, the mature engine SGLang (v0.5.20) took about 12 seconds, while the engine written by Claude only took 0.48 seconds.

Under the same hardware and model conditions, the P90 time to first token latency of Claude's self-developed inference engine is 0.478 seconds, compared to 12.029 seconds for SGLang.

Waiting 12 seconds is long enough for you to switch back to the editor and scroll through several lines of code along the error message. What about half a second? The moment you press Enter, you can see the first word of the AI's response in the dialog box.

Once the response starts, the generation speed of the two engines is almost the same: by median, the engine written by Claude generates 124.2 tokens per second, and SGLang generates 125.0 tokens per second.

How on earth did Claude save those 11 and a half seconds before the AI starts outputting?

Changing Only One Line of Code

How Much More Does the Server Need to Process

Suppose you are using AI to modify a web page.

You have pasted the source code and error messages before, and tried several versions of solutions. In this round, you only add one line: "Move the login button a little to the right".

In the programming sessions replayed in the paper, the chat history from previous rounds is also sent to the server together. When 16 sessions run simultaneously, the median single input length is 89,000 tokens.

The model has to process the input first before it can start responding: this step is called "prefill".

If the beginning of a new round of request is the same as the previous round, the engine can call up the precomputed results and continue processing the newly added content, which is called "prefix caching".

The "precomputed results" here refer to the calculation records left after the model finishes reading the preceding context. The model used in this test leaves two sets of such records.

One set retains the information of the preceding context for the model to refer back to; the other set is like the balance in a ledger, which updates every time the model reads a little more content.

The engine written by Claude stores the two sets of records corresponding to the same preceding context together. The next time it encounters the same prefix, the engine can continue reading from the end of that preceding context, and only compute the newly added content afterwards.

SGLang also uses prefix caching, and the cache hit rate of both engines is around 96%.

When 16 requests come in at the same time, the content that misses the cache still needs to be processed by the GPU.

The remaining computation load of each request and the processing order of the GPU also determine how soon you can see the first word of the AI's response.

Performance comparison between Claude's self-developed inference engine and SGLang. The two have similar cache hit rates and generation speeds, but the P90 time to first token latency of Claude's engine is significantly lower.

The Less Remaining Work, the Higher the Priority

Sort Tasks by Remaining Workload

Imagine the checkout scenario in a supermarket:

The customer in front of you is pushing a full flatbed cart of New Year goods, with tens of thousands of brand new tokens waiting to be scanned from scratch.

You are standing behind, holding only a bottle of mineral water — which means you only added one follow-up question in the old session, and 96% of the preceding context already has ready cache.

Sticking strictly to "first come, first served" in concurrent inference is equivalent to making the person buying a single bottle of water wait behind the customer with a whole cart of goods.

Therefore, Claude set a queuing rule for the inference engine:

The request with less remaining computation load gets processed first.

When encountering a new large task of tens of thousands of tokens, the engine will split it into small chunks to process in batches, and never let one large task block the entire processing pipeline.

In this way, the follow-up question you added in the old conversation can skip the waiting of long requests and get processed preferentially.

In the generation phase, the engine also enables "speculative decoding":

The lightweight prediction layer built into the model guesses a token first, and the main model verifies it later. If the guess is correct, the prediction result is directly adopted; if the guess is wrong, the prediction is discarded and generation continues according to the result of the main model.

At the same time, the engine also packs and merges the scattered GPU operations that were originally executed separately, reducing unnecessary scheduling and data movement.

Even though SGLang also enables prefix caching and speculative decoding, the engine written by Claude still has advantages in input processing and request scheduling: on average per GPU per second, it can process 19% more uncached tokens.

The horizontal axis is P90 time to first token latency, and the vertical axis is the number of uncached tokens processed per GPU second. Claude's self-developed engine reduces the waiting time for the first token while improving the processing efficiency of uncached inputs.

Within the same replay time limit, SGLang completed 705 requests, while the engine written by Claude completed 983 requests, processing nearly 40% more.

Then calculate the "simulated revenue" for the completed requests according to the preset unit prices of input and output. The output of Claude's engine per GPU hour increased from 8.18 USD of SGLang to 11.52 USD, a 40.8% increase.

Developers can get AI responses earlier, and the same GPU can process more requests in the same period of time.

Of course, real work scenarios only recognize delivery results: running extremely fast but outputting complete nonsense is called "high-speed crash".

The researchers set two hard thresholds for submission: first, under concurrent load, the engine must fully generate responses of the specified length; second, it must pass the accuracy acceptance of hidden tests.

Among the 11 AI self-developed engines that participated in the test, only 5 finally passed both thresholds; the other 6 either truncated words and sentences halfway, or collapsed in accuracy, and got zero points on the spot according to the rules.

11 AI Teams Building Infrastructure

Claude Won 5 Times and Tied Once

Building an inference engine manually is only one of the six exam questions in Singularity-Bench.

The research team split the core tough work of building AI into six independent closed-book exams: three for training (pre-training from scratch, data selection for mid-training, post-training reinforcement learning for code writing), and the other three for infrastructure (inference engine, agent runtime framework, GPU cluster scheduling).

The research team divided AI R&D into three stages: training, deployment and application, and set up six tasks to test whether agents can independently optimize the AI R&D process.

11 AI teams formed by combining 7 mainstream models with two runtime frameworks (Claude Code and Codex) received the starting code offline, submitted their work according to the countdown, and competed head-to-head with mature solutions polished by humans for many years on exactly the same hardware.

In addition to the big win in inference, Claude Opus 5.5 paired with Claude Code also beat the human baseline in four other tasks.

When receiving the pre-training exam paper (4 GB300 GPUs, 12 hours), Claude did not rush to start training, but spent 44 minutes testing GPU performance first, then determined the model size according to the test results. It did not start training until the 44th minute.

In the end, Claude used only about half of the training computation, and achieved a perplexity of 12.77 on the validation set, which is better than the 14.22 of the human baseline (OLMo 2 1B paired with Megatron-LM).

For the mid-training task (4 GB300 GPUs, 12 hours), the exam question was changed to select the next batch of "teaching materials" for the existing model, and then use the same set of reinforcement learning tasks to test the training effect, examining the model's performance in mathematics, code and scientific fields.

Claude mainly selected data with complete problem-solving processes and verified answers. In the end, its solution increased the downstream average accuracy from 17.5% of the human PRISM recipe to 31.9%, nearly doubling.

The agent runtime framework task (1 GB300 GPU, 6 hours) is the most dramatic: this task tests when the model calls tools and how to check logs after errors, and the human control group is exactly the original Claude Code.

As a result, Claude performed a "surgery" on itself, raising the downstream average score from 0.438 to 0.468. In the same batch of tests, the new framework fixed one more bug than the original Claude Code.

The cluster scheduling task (16 GB300 GPUs, 4 hours) required using 16 GPUs to serve the service requests of 28 models at the same time.

Claude found in actual measurement that when some engines share GPUs, they will compete for resources and slow each other down, so it adjusted the scheduling strategy to let them use the GPU in turn.

In the end, it scored 0.510 comprehensively on the two indicators of latency compliance rate and request completion rate, exceeding the 0.460 of NVIDIA Dynamo paired with KAI Scheduler.

It can even modify its own framework, and beat NVIDIA's solution in the cluster scheduling test. Claude has fully demonstrated its engineering capabilities this time.

The only task that did not produce a winner was post-training (4 GB300 GPUs, 12 hours).

Claude used reinforcement learning to improve the programming ability of the given model, and the final problem-solving rate was 53.3%, while the human control solution Miles reached 53.9%. Comparing question by question, both sides had 18 questions that only they solved, so the paper judged it as a tie.

The six scores are summed with equal weight, taking the human baseline score of 1 as the reference. Opus 5.5 paired with Claude Code scored 1.252 with "five wins and one tie", becoming the only combination that exceeded the human baseline. The second place, GPT-6.1 Sol paired with Codex, scored 0.969, and the remaining 10 groups averaged only 0.58 points.

The overall ranking also reveals another point: The model's core capability determines the upper limit of performance, and the runtime framework determines how much of that capability can be exerted.

For the same open-source model, pairing with Codex scored 0.228, while switching to Claude Code raised the score to 0.657, nearly 3 times the original value. For another model, the situation was exactly the opposite: pairing with Codex scored 0.698, while switching to Claude Code dropped to 0.520.

This shows that a sufficiently powerful model is not enough. Without the right framework, you may still get subpar performance.

After taking the first place in the overall ranking, how much did Claude spend just on API calls?

For API calls in the development phase alone, Opus 5.5 spent 425.41 USD, higher than the 328.19 USD of the previous generation Opus 5, and about 5 times that of the second-place GPT-6.1 Sol (84.52 USD). GPU and downstream evaluation costs are calculated separately.

The Next Task