How to Deploy Open-Weight Models for Coding at Your Company
Note: We thank the Google Developer Experts (GDE) program for sponsoring the TPU credits used in this investigation.
In this blog, we’ll work through how to build an inference system for a company with 100 engineers, so they can use coding agents and have a good experience within a modest hardware budget. At first, this might sound as simple as starting an inference server with vLLM and pointing a coding client at it. That gives us a model endpoint, but serving coding agents across a team brings its own set of challenges.
Challenges
Coding agents alternate between asking the model for help and doing work in the repository—reading files, running tests, and waiting for tools to finish. When a team shares one endpoint, that rhythm brings a few things for us to work through:
- Long conversations use memory. A resumed turn brings back earlier messages, file contents, and tool results. The KV cache lets the model reuse some of that work, but the cached state takes up TPU memory (HBM). Keeping more histories can make an agent’s return quicker, but leaves less memory for other sessions. Evicting a history frees memory, but means more input work when that agent returns. This mainly affects resume time and compute used per session.
- Tool waits leave HBM occupied while FLOPs sit idle. When an agent is waiting for a test, its KV cache may remain in HBM even though the TPU is doing no generation for it. Another request can use that spare compute. If it is still running when the waiting agent comes back, the returning request queues. Filling the compute gap can improve hardware use, but may hurt resume time and streaming smoothness.
- Demand comes in waves, with different context sizes. One hundred engineers do not send requests at a constant rate. Several agents may return at once, and a long history takes more memory and input processing than a short one. A burst can build a queue or crowd the memory pools, affecting failed requests and resume time.
- More tokens per second can still feel slower. Aggregate throughput does not tell us how long one engineer waits after a tool finishes, how long the complete next action takes, or whether the stream pauses. We need to track those separately.
- A faster setting can change the work. Shortening the output limit or reducing reasoning may make a response finish sooner, but it can also leave a coding task incomplete. We need to improve the service while keeping the selected model behavior intact.
Setup
We will keep the model and its reasoning setting fixed as we work through the serving questions. Our starting point is the Qwen/Qwen3.8-27B checkpoint, running with medium reasoning on a four-chip v6e 2×2 slice. The model server exposes an OpenAI-compatible API for the coding client. The notes here record the machine, checkpoint, and serving settings so each comparison has a clear starting point.
Our first measurements used a Tokyo VM; when that machine was unavailable, we continued on a replacement four-chip v6e VM in the Netherlands. On the replacement, downloading the checkpoint took about 20 seconds and loading its shards took 2.71 seconds. Compilation dominated startup: from the replacement VM’s recorded start to the first contract response was about 12 minutes, including installation and checkpoint download. That’s a useful consideration for any plan to stop the service overnight; it is one observed startup, not a guaranteed restart time.
Inspecting the machine
Before installing anything, we inspect the machine and accelerator available to the model server:
cat /etc/os-release
python3 --version
df -h / /dev/shm
free -h
lsblk -f
lspci -nn
curl -fsS -H Metadata-Flavor:Google \
http://metadata.google.internal/computeMetadata/v1/instance/machine-type
curl -fsS -H Metadata-Flavor:Google \
http://metadata.google.internal/computeMetadata/v1/instance/attributes/accelerator-typeThe metadata reports ct6e-standard-4t and v6e-4. The PCI listing shows four Google accelerator devices. This is our four-chip v6e slice; the runtime check shortly will show the 2×2 device coordinates.
The machine is running Ubuntu 22.04.5 with Python 3.10.12. It has about 708 GiB of host memory, but the root filesystem is only 9.6 GiB, with about 6.5 GiB free at inspection time.
That last detail changes the setup immediately. The checkpoint alone is much larger than the free boot disk. Host memory and accelerator memory are also different things: the large number from free -h does not tell us how much model state fits on the TPU.
For this initial setup, we put the environment, package cache, and model download in a task-specific directory on /dev/shm, which has about 355 GiB available. This is a temporary, memory-backed location. Its contents disappear after a reboot. Logs and the dependency lock go under our home directory so that the setup record survives.
A repeatable deployment will need durable model storage or a startup download step. We have not provisioned another disk or another TPU slice for this setup.
Installing the serving runtime
We start with vLLM JAX, distributed through the vllm-tpu package. The current quickstart requires Python 3.11 or newer, so the machine’s Python 3.10 is not enough.
We install uv, then ask it to create an isolated Python 3.12 environment. These are the commands used on the VM:
curl -fsSL https://astral.sh/uv/install.sh | \
env UV_INSTALL_DIR=/home/anshumanmishra/.local/bin sh
mkdir -p /dev/shm/tpu-agent-service/tmp
mkdir -p /home/anshumanmishra/tpu-agent-service/evidence
chmod 700 /dev/shm/tpu-agent-service
export UV_CACHE_DIR=/dev/shm/tpu-agent-service/uv-cache
export TMPDIR=/dev/shm/tpu-agent-service/tmp
/home/anshumanmishra/.local/bin/uv venv --python 3.12 \
/dev/shm/tpu-agent-service/venv
/home/anshumanmishra/.local/bin/uv pip install \
--python /dev/shm/tpu-agent-service/venv/bin/python \
vllm-tpu==0.33.0 \
> /home/anshumanmishra/tpu-agent-service/evidence/install.log 2>&1uv selected Python 3.12.16. The installation completed. We then checked whether the environment could import the serving runtime and discover the TPUs:
/dev/shm/tpu-agent-service/venv/bin/python - <<'PY'
import importlib.metadata as metadata
import jax
import vllm
print('vllm', vllm.__version__)
print('tpu-inference', metadata.version('tpu-inference'))
print(jax.devices())
PYThe output was:
vllm 0.33.0
tpu-inference 0.33.0
[TpuDevice(id=0, process_index=0, coords=(0,0,0), core_on_chip=0),
TpuDevice(id=1, process_index=0, coords=(1,0,0), core_on_chip=0),
TpuDevice(id=2, process_index=0, coords=(0,1,0), core_on_chip=0),
TpuDevice(id=3, process_index=0, coords=(1,1,0), core_on_chip=0)]
This setup check established that the runtime imports and JAX sees four devices in a 2×2 arrangement. We subsequently verified streaming and a small live tool loop, as described above.
We also save the complete resolved package set. A top-level version is useful, but it does not pin all the dependencies that were installed with it:
/home/anshumanmishra/.local/bin/uv pip freeze \
--python /dev/shm/tpu-agent-service/venv/bin/python \
> /home/anshumanmishra/tpu-agent-service/evidence/requirements.lockDownloading the model checkpoint
We use the Qwen/Qwen3.8-27B checkpoint:
The actual download command was:
export HF_HOME=/dev/shm/tpu-agent-service/hf
/dev/shm/tpu-agent-service/venv/bin/hf download Qwen/Qwen3.8-27B \
> /home/anshumanmishra/tpu-agent-service/evidence/download.log 2>&1The download completed, and the Hugging Face cache occupied about 52 GiB according to du -sh. That is a disk-usage observation, not a measurement of accelerator memory consumption.
The checkpoint configuration identifies a hybrid model: 64 language layers, with 16 full-attention layers and 48 linear-attention layers. This will matter when we test retained state. We cannot establish correct caching for this model by checking only the full-attention cache.
Client interface
The model server exposes an OpenAI-compatible Chat Completions API under the served model name qwen-tpu. The coding client needs the server endpoint and model name; repository tools continue to run in the coding client.
Stopping the model worker does not release the TPU VM allocation. At the end of a measurement block, we export the evidence and stop the VM if there is no next experiment ready. A restart may require rebuilding the temporary environment and downloading the weights again; that is part of the setup allowance, not hidden experiment time.
Worker: vLLM TPU 0.33.0 and TPU inference 0.33.0; Qwen3.8-27B checkpoint; four chips with tensor parallelism 4.
Engine baseline: 32,768-token maximum sequence; 8 simultaneous engine sequences; 8,192-token batched-prefill budget; memory utilization setting 0.85; prefix caching enabled. Image and video limits are zero. We use the qwen3_coder tool parser and qwen3 reasoning parser, as in the vLLM Qwen3.8-27B recipe. The earlier smoke test used the qwen3_xml name; vLLM TPU 0.33.0 maps both names to the same parser, and our launch configuration now uses qwen3_coder.
Server launch command: this is the command from deploy/worker.sh, using the model repository name for readability. The worker uses the downloaded checkpoint and the cache setting selected for each run.
/dev/shm/tpu-agent-service/venv/bin/vllm serve Qwen/Qwen3.8-27B \
--served-model-name qwen-tpu \
--host 127.0.0.1 --port 8000 \
--tensor-parallel-size 4 --dtype bfloat16 \
--kv-cache-dtype bfloat16 \
--language-model-only --limit-mm-per-prompt '{"image":0,"video":0}' \
--max-model-len 32768 --max-num-seqs 8 \
--max-num-batched-tokens 8192 \
--gpu-memory-utilization 0.85 \
--enable-prefix-caching \
--enable-auto-tool-choice --tool-call-parser qwen3_coder \
--reasoning-parser qwen3 \
--default-chat-template-kwargs '{"enable_thinking":true,"preserve_thinking":true,"reasoning_effort":"medium"}'Precision: BF16 weights and attention cache. The recorded hybrid-state allocation uses BF16 and FP32 arrays. We do not quantize any of them in this study.
Generation: medium reasoning; thinking enabled and preserved; temperature 1.0; top-p 0.95; top-k 20; min-p 0; presence penalty 0; repetition penalty 1.0. The default output allowance is 2,048 tokens, including reasoning. Reaching it is an incomplete action. Collision and shared-session comparisons use the same allowance in both arms; any truncation stays visible.
Clients: up to eight requests in flight for the small probes; the planned shared-session comparison raises this to sixteen while leaving the baseline engine sequence limit at eight, so client throttling does not hide the engine queue. Requests have a 90-second deadline inside the shorter whole-experiment deadline. Each live task has its own turn and wall-time caps. No automatic retry, silent fallback or history compaction is allowed. A failed request aborts its dependent continuation; independent offered sessions remain accounted for.
Cache state: /reset_prefix_cache returned 404 in the earlier runs. We do not assume a reset works. Before comparisons, we verify isolated cache namespaces with a repeated-prefix and a distinct-namespace control. Both attention reuse and hybrid-state association must respect the namespace. If that is unsupported, we revise the cache-conditioning/restart plan offline and charge its time to the allocation limit. Unknown or mismatched initial cache state blocks a causal comparison.
Evidence: one full JSON per completed or incomplete session, incremental request records, complete finish reasons, actual token counts, tool events, queue events and telemetry timestamps. Every experiment records planned, attempted, completed, failed, truncated, cancelled, aborted and unoffered-by-budget work separately. A request that never dispatches can still violate the offered-work target.
These are the baseline settings; candidate changes and load-specific client limits are declared in the methodology appendix. Any planned facility not yet implemented—particularly cache namespace isolation and hybrid-pool attribution—is a prerequisite, not an accomplished setup step.
What are we optimizing for?
We want the service to help engineers get back to useful work, while making effective use of the hardware. These are our starting objectives and guardrails. The numerical targets are for the demo; they are not results yet or requirements set by a company.
- Coding behavior guardrail: the chosen model’s existing coding benchmarks are our quality reference. We are not repeating that evaluation here. A serving change must still produce valid tool calls and complete actions, and pass the existing checks on our live coding task; a truncated response does not count as complete work.
- Warm-resume latency: for interactive turns with up to 32 Ki tokens of context and 2 Ki tokens of new input, our starting target is visible progress within two seconds on at least 95% of warm resumes. We will also report first-token time and time to the next complete tool call or actionable answer. Initial turns and longer contexts are reported separately.
- Streaming smoothness: we will report the 95th-percentile gap between visible response chunks and the share of responses with any gap longer than one second. We will also keep client-visible timing separate from the server’s token timings.
- Peak-load reliability: at the declared busy-hour load, our starting target is for at least 99% of offered turns to complete without rejection, timeout, or service failure. We will report queue age and latency, and separately check the effect of one worker becoming unavailable.
- Compute efficiency: for a fixed workload that meets the experience targets, we will count all allocated TPU chip-hours, including setup, idle periods, failures, and spare capacity. Until we have enough live coding-task outcomes to calculate cost per successful task, we will report cost per replay session that meets the latency targets as an interim measure.
Let’s follow one small coding task through the client, model and repository tools.
As we can see, an agent can stop asking the model while its tool runs, even as its cached conversation may still occupy TPU memory. In this small task, the next step began 0.74 to 5.25 seconds after a tool finished. Five observations are not enough to estimate a p95 or explain the slowest gap. Let’s look at the conversation each resumed request carries back to the model.
Why are we reading the same history again?
Every return from a tool is another model request. The engineer may have typed one sentence, but the next request contains much more: the original question, files, earlier reasoning, tool calls and their results. Most of it has already passed through the model.
This is why the following picture matters.
The source article by Diogo asks how repeated history affects an agent’s API cost. Its example assumes perfect cache hits and particular API prices. Our endpoint’s hardware cost accrues over time, so we need to understand what the accelerator is doing throughout an agent session.
If the engine keeps a reusable representation of the earlier history, the next request can avoid processing that prefix again. We still need to process the new result and generate a response. Reuse should therefore remove one part of the wait, rather than make the whole response free.
Our first check suggested reuse could save input work, but visible response times still varied. So we made the comparison more controlled: keep the follow-up fixed and change only whether its earlier history is reusable.
Our first small comparison shows why that distinction matters. With roughly 8 Ki tokens of history, the first generated event arrived in 0.57–0.73 seconds with caching enabled, versus 0.92–0.99 seconds with caching disabled. That is consistent with saved input processing.
But visible output was less tidy: 0.77–1.72 seconds with caching, versus 1.11–1.39 seconds without it. The model generated different amounts of reasoning, and the arms ran separately. Three observations cannot establish a visible speedup. We have evidence of reuse, and a better question to ask next: how much of the engineer’s wait can reuse actually remove?
Let’s try the same follow-up at three context lengths. We keep the conversation and tool result the same, then use a fresh cache key for the second request. The server’s prefix counter tells us whether the earlier input was reused. We ran two pairs at each length on our replacement v6e slice.
The longer-context pairs show why keeping history can help. The exception is just as useful: a cached request can still wait on reasoning and generation. Saving input work removes one part of the engineer’s wait.
At 28 Ki, the two saved-history requests became visible in 1.16–1.20 seconds; the fresh-key requests took 2.68–2.72 seconds. The saved requests each reused 28,656 input tokens according to the server counter. That’s a useful improvement in this small comparison.
But look at the first 16 Ki pair: the saved-history request took 4.03 seconds to show visible output, despite reusing 16,368 tokens. It generated 249 tokens in total; its fresh-key partner generated 83. Reusing input helps, and we still need to account for the model’s reasoning and output when we ask whether the engineer gets a timely next action. Two pairs per length are a diagnostic, not a p95.
While the test runs, who is using the TPU?
When a test is running, its agent may leave history in TPU memory while another engineer uses the compute. That is how sharing can help us serve a team on a modest slice.
The awkward moment is when the test finishes. Another agent may still be generating, or a new request may be processing a large repository. Can our returning agent get moving without interrupting everyone else’s stream?
Let’s make that return awkward on purpose: keep three responses streaming, add a large cold request, then bring our waiting agent back. We use the same saved continuation for both batch settings.
The shorter stream gaps make smaller batches worth investigating. The returning agent itself barely changed in this pair, so we shouldn’t promise the company a faster resume from this setting alone.
We also checked that our trigger really placed the resumed request alongside cold prefill in the scheduler. It did after we moved a client-side token audit out of the timed window. The distinction matters: a convincing-looking timeline is useful only if the recorded events support it.
We already saw two short requests fit inside an assigned pause. Our next comparison makes the overlap harder: we introduce a cold 24 Ki-token request while other agents are streaming, and release a waiting agent during that overlap. We measure whether the cold input slows their streams or delays the returning agent. If it does, we compare the baseline with one smaller prefill chunk budget.
With caching disabled, we tried this once with three active streams. All three were still running when we sent the cold request and the returning agent’s follow-up. The follow-up reached visible output in 1.75 seconds and returned the correct marker; the longest visible chunk gap among the three streams was 0.45 seconds. All six requests, including the seed, completed. The timing shows overlapping requests; we could not observe the exact prefill interval, so we cannot yet say which part of the cold request overlapped. An earlier version of the probe hit the output limit on all three background responses, and remains recorded as incomplete.
We then saved one generated tool call and its result, so both scheduling settings received exactly the same returning-agent input. Both five-request arms completed. With the smaller 4,096-token budget, the returning agent became visible in 1.85 seconds and completed its next action in 2.01 seconds. With 8,192, those times were 1.86 and 2.10 seconds. The longest visible gap in the three background streams was 0.21 versus 0.42 seconds. That gives us a useful observation, but one pair with different generated response lengths is too little evidence to choose the setting for the company.
There was still a timing question hidden in that comparison. Had the returning agent actually shared a scheduler batch with the cold request’s input processing? We added a request-level trace and ran a separate five-request probe. The trace recorded 339 scheduling batches, but our analysis did not establish a batch containing both the cold request’s prefill work and the resumed request. We can discuss how these overlapping requests behaved; we cannot attribute the delay to simultaneous prefill from this probe. Scheduler decisions also do not measure accelerator kernel overlap. This is where a more precise trigger matters more than simply adding requests. We found a delay in our own client: it was still auditing the returning request’s token count after releasing the trigger. We moved that audit before the timed window and released the resume when the trace first showed cold prefill being scheduled. The corrected five-request probe completed, and the trace now shows two batches containing both cold prefill and the resumed request. It also records four batches with the resume known to the scheduler while cold prefill was scheduled. That establishes the intended scheduler overlap for this probe; it still does not describe simultaneous accelerator kernel execution. This verification used the corrected cache-enabled runtime, so it is not an extra matched arm of the earlier cache-disabled comparison.
What if the compute is free but the memory is full?
Sharing compute leaves another question. When an engineer comes back to an old chat, is its processed history still there? If other requests have displaced it, the server has to process more of that conversation again. The chat is still available to the client; the extra work shows up as delay and compute on the server.
We keep one agent’s follow-up fixed, let other private histories compete for the cache, then bring that agent back after their inference work has finished. That helps separate memory pressure from an active inference queue.
At the smaller cohort, the saved history remained reusable. At the larger one, reuse disappeared and the returning agent waited longer. We now have an observed cost of losing history, but not an exact boundary or a policy that is optimal for every tool-wait duration.
Getting this far required fixing a runtime problem first: concurrent cached requests were interfering with each other’s state. We verified a small upstream backport before running the pressure study. The implementation and checks are recorded below.
Our worker allocated separate pools for full-attention state and linear-attention state. That gives us a more specific hypothesis: perhaps one pool loses reusable histories while the other still has room. We have measured their allocations; their eviction behavior is the next measurement.
The runtime already showed us why both pools matter. With prefix caching enabled, its startup log allocated 65 recurrent-state slots and 47,786 attention blocks. When we restarted the same worker with prefix caching disabled to investigate a concurrency failure, it allocated 9 recurrent-state slots and 56,007 attention blocks. Those are startup allocations, not measurements of occupied histories or eviction. They do show that turning caching off changes the memory layout as well as reuse.
We will save one agent’s real follow-up and replay it after progressively more conversations have competed for memory. The competing requests finish before we send that follow-up, so an active queue is less likely to obscure the cost of lost state. There is no need to spend two minutes waiting at each point: we resume two seconds after the seed work drains and record the actual age of the history.
We attempted an eight-history pressure check. The sentinel agent’s initial call and baseline follow-up worked, but six of the seven competing seed requests ended without an action. We stopped before sending the sentinel’s pressured follow-up, so we have no eviction result yet. That failure led us to the smaller concurrency checks below.
Why were requests failing before memory pressure could teach us anything? A small concurrency check reproduced the incomplete answers, and disabling prefix caching removed the failures in that check. An upstream candidate fix pointed to a missing initialization hook: the single-host engine could use the wrong manager for the model’s recurrent-state pool. Our installed worker was missing that hook too.
We applied a reversible backport and checked the basics before returning to pressure. Seven tool-call requests passed at concurrency one, two and four. Repeating a private cache key showed reuse; changing the key did not reuse that prefix. Those small checks let us continue the investigation, without treating them as a production reliability guarantee.
The corrected worker gave us a chance to try again. We ran small cohorts of one, four and eight histories, using a new private cache key for every agent and carrying each generated tool call into its own continuation. All 29 requests completed. The sentinel’s repeated follow-up reused input in each cohort: isolated counter intervals recorded 24,640 hit tokens after the competing work, compared with 24,560 on its first follow-up. The same saved follow-up was used within each cohort; cross-cohort generations can differ.
At four histories, the post-pressure response became visible in 0.53 seconds; at eight, 0.51 seconds. The marker from the actual tool result was preserved. We have not forced eviction at these tested sizes, so these measurements give us a retention lower bound, not a sweet spot or the cost of rebuilding an evicted history. The aggregate counters also do not identify which state pool would reach its limit first. We should not invent that boundary from the allocated HBM reading.
Could we push far enough to lose the sentinel’s saved work? We kept its follow-up fixed within a larger probe and introduced 31 competing private histories, for 32 histories in total. This was a cache-pressure diagnostic: the competing requests completed their seed calls, rather than continuing through full coding sessions. All 34 requests completed.
Before pressure, the sentinel reused 24,560 tokens and became visible in 0.66 seconds. Afterwards, its isolated reuse-counter delta was zero, and visible progress took 1.70 seconds; the response finished in 1.83 seconds, with the tool-result marker intact. Losing reuse added about 1.04 seconds to visible progress in this one comparison. This gives us an observed recovery cost to work with. It does not identify the evicted pool or locate an exact retention threshold between eight and 32 histories.
The result we want is a curve: histories kept versus reuse, extra input work and the delay on returning to a chat. Alongside it we show how much other work fitted on the same allocation. That should help us find a useful range for sharing memory while keeping returning engineers responsive.
Which change helps the engineer?
If cold input processing disrupts streaming, we can give the scheduler less input work per batch. If an engine sequence limit leaves ready work queued while memory and compute have room, we can test a larger sequence limit. If a hybrid pool loses state first, we inspect how that setting changes the pool allocation before expecting faster returns.
We choose one change and rerun the same offered workload. The question is whether more sessions meet the experience targets per allocated chip-hour. More tokens per second alone will not answer it.
The model stays at medium reasoning with BF16 weights and state. We also record reasoning tokens and the time before visible output: if the baseline’s reasoning already uses most of our two-second target, we need to expose that constraint to the company.
What would we recommend to the company?
The company needs a recommendation it can use: which workload this hardware can support, when engineers start waiting longer, and where additional compute would help. Our measurements already show why neither completed requests nor a good median is enough. The remaining deployment questions concern sustained demand, warm-cache load and independent-worker resilience.
The closing scorecard brings the final measurements together. We use the individual figures above to understand the tradeoffs before making that recommendation.
A simulator should earn our trust the same way as a serving change: make a prediction, measure a separate workload, and compare the two. Our first attempt missed; separating internal reasoning from visible output helped the corrected model pass a fresh check. That is a useful step toward planning, while multi-worker recommendations still need evidence across workloads and routing policies.
The additional four-session run with the original 8,192-token budget also completed 76 of 76 turns. Its median wait to visible output was 1.99 seconds, with a sample p95 of 4.53 seconds and one response containing a visible gap over one second. Together with the repeated smaller-budget runs, this reminds us to look at the whole workload and slow cases rather than picking a configuration from its best median.
We tried a more explicit model next: split input into scheduler-sized chunks, generate output a token at a time, and let other sessions run while a tool waits. After fitting its effective rates on the earlier wave, we saved a prediction before another four-session run. All 76 hardware turns completed, but the predicted median wait was about 29% away from the observation. Our predeclared tolerance was 25% for each checked quantity, so this model did not pass. Matching the tail and total duration more closely does not repair that miss. We have a useful accounting tool to improve, rather than a basis for choosing the company’s fleet size.
The corrected model then passed its prospective four-session check. That check is workload-specific; it does not validate a multi-worker fleet model.
Before choosing a fleet size, we check whether our CPU model can predict a measured load point it was not fitted on. Then we can explore one, two and three workers, comparing round-robin routing with session affinity. Affinity may save repeated input work, but it can also concentrate queues. We measure that tradeoff in the model instead of assuming a fixed cache-hit improvement from the replica count.
Our allocation accounting includes startup, idle periods, failed runs and restarts. A monthly comparison with an API provider needs a declared operating schedule and equivalent workload; we have not measured that comparison here.
A second replica on the same slice still shares its hardware failure domain. Precision changes, a 64 Ki context and a different tensor-parallel layout need separate model/runtime checks and compute; they remain follow-up decisions after we know what limits this baseline.
Methodology & limits
The notes below preserve the measurement plan, sample counts and evidence limits. The narrative above describes what the completed runs taught us. The corrected collision probe and initial retention cohorts are complete; the fresh simulator check and larger cache-pressure probe are complete. Planned bounds and later changes are recorded with the run evidence.
Preflight
Source and samples: one locally authored chunk_bug repository fixture from experiments/task_fixtures.py; three API contract requests—text, a valid tool call, and its actual tool-result resume. Three additional repeated-prefix/namespace probes check cache isolation. The live task is capped at 10 model turns, so the total is at most 16 requests. We stop early on the first protocol failure. A’s completed 19-turn record is reused for transcript coverage; we do not rerun it just to fill this budget.
Load and configuration: one client, no competing inference; shared serving baseline above. The live task runs through OpenCode, reads and edits its own fixture, runs python3 -m unittest -v, and preserves the existing tests. Its wall-time cap is 180 seconds. The API probes use the remaining experiment time; the entire measurement block stops at three minutes.
What we save: exact incoming and outgoing messages; reasoning; IDs, tool names and complete JSON arguments; actual tool stdout/stderr and exit status; rendered and server prompt counts; finish reason; timing of first generated event, first visible content and next complete action. The namespace check needs isolated cache-counter intervals; a counter increase shared with unrelated traffic is not a pass.
Pass and stop: correct association and preserved reasoning; independent fixture tests pass without changing them; no truncation, missing action or token mismatch. Repeating a namespace must demonstrate reuse; a new namespace must not reuse the prior namespace’s private state. If the runtime cannot expose enough evidence for that distinction, cache-isolated comparisons remain blocked. We fix that locally before any load run.
How we inspect the result: an inspectable causal trace and a simple timeline from tool completion to visible output and complete next action. This protects KPI 1 and establishes the timing boundaries for KPI 2. It is not a remeasurement of published model quality.
API and namespace checks are preflight, excluded from the experiment table. Their requests and allocated time still count. Before any paid run, verify the exact installed hybrid-cache behavior, tokenizer contract and request accounting locally where possible.
Measurements and decisions
| Question | Samples and load | Maximum requests | KPI and decision |
|---|---|---|---|
| What does reuse save? | Two generated histories at each of 8, 16 and 28 Ki input tokens; each resumed with reuse and without it | 18 | 1, 2, 5: avoided input work versus visible/action delay |
| What happens after eviction? | Cohorts at N=1, 4, 8, then one adaptive boundary check; two turns per agent | 52 | 1, 2, 5: which pool loses state, recovery delay, useful memory-sharing range |
| Does cold input disrupt other agents? | Three active streams, one cold 24 Ki request and one resumed agent; baseline and one candidate, up to two repeats | 20 | 2, 3, 5: streaming gaps, cold-request completion and resumed action delay |
| Where does shared service slow down? | Four full 19-turn sessions (76 requests); a second block of eight (152 requests) allocated to higher overlap, a sustained window or candidate validation | 228 | 2–5: load curve, queueing and completed compliant work; repeat exact schedules for a policy comparison |
| Does the loop still work? | One live task up to 10 turns, one cancel and one recovery request | 12 | 1, 4: tool/test regression, cancellation and cleanup |
Aggregate cap: 330 experiment requests + 16 preflight + 6 warmups = 352 additional requests. Per-stage caps are ceilings. New startup probes, repeats or failed attempts consume these caps; there is no uncounted tuning allowance. The second load block is a shared resource: testing a higher load and validating a policy both require their own budget and cannot each claim the same 152 requests.
Reuse and latency clocks
We keep medium reasoning, the generation settings and the saved continuation input fixed. Context targets of 8,192, 16,384 and 28,672 are seed-input targets, not permission to exceed the 32,768-token total context. Audit each complete follow-up plus its output allowance before allocation.
Prefer a request-level cache_salt that changes the cache key without changing model input, only after verifying it isolates both attention and recurrent state on the pinned TPU runtime. The warm resume uses the seed’s namespace; its paired miss uses a fresh namespace. Counter evidence must establish the achieved reuse in both arms. A salt sentence in the system prompt changes tokens and can change reasoning; it is not an identical-input cache control. The vLLM cache design documents request-level salts and LRU block eviction for the upstream cache manager; we must verify the TPU hybrid path separately. If isolation is unsupported, revise the control offline or use one bounded cache-off block within the startup reserve.
Separate first generated event, first visible content and complete action. Record generated reasoning length and finish reason on each pair. Client timestamps alone do not separate queueing from prefill. Plot those two pieces separately only when worker instrumentation provides both; otherwise label the interval combined. A latency range in a few runs is a diagnostic, not a certified p95.
Eviction and recovery
Every agent has a unique controlled 24 Ki file-reading history, its own actual generated tool call/reasoning, and a real marker-bearing file result. Hold the sentinel’s saved follow-up identical across comparisons; other agent histories are distinct. Comparable initial cache conditioning is required across cohorts, including stale prior cohorts. A namespace prevents reuse but does not free its old allocations.
Begin with one cohort each at N=1, 4 and 8: 26 requests. If reuse survives N=8, N=12 adds 24 requests, followed by a two-request N=1 control. If reuse falls by N=8, repeat the N=4 and N=8 cohorts (24 requests) plus the two-request control. Maximum 52 requests. This brackets a tested range; failure to reach eviction remains an honest lower bound.
Resume the sentinel two seconds after all competing seed requests drain. Drain time, actual history age and pool occupancy are saved. Other agents resume afterwards and all their work stays in the accounting. This is a capacity-driven retention probe, not a time-based expiry measurement. Natural tool timing is preserved separately in the shared-session load.
Record attention-block and recurrent-checkpoint occupancy, evictions, reusable input, extra prefill work and the sentinel’s generated/visible/action clocks. A flat total HBM reading cannot establish which pool evicted state. If attribution is unavailable, report aggregate reuse and recovery only, and leave the pool-specific hypothesis unresolved.
Collision and one targeted setting
Baseline: three fixed complete streaming prompts, one cold 24 Ki request, and one saved causal tool-result resume: five requests. Arm the cold request only after all three streams have started and are still active. Dispatch the resumed agent when cold prefill is observed active, or at a declared fixed offset from cold dispatch if that telemetry is unavailable; the latter is attempted overlap and must be reported that way. Record actual overlap; an early completion is not discarded. Use the same release rule, prompt inputs and output allowance for the candidate. Keep all medium-reasoning output and record truncations.
Compare baseline with one smaller max_num_batched_tokens (8,192 to 4,096), provided the pinned runtime supports the intended scheduling. Two configurations × five requests × at most two repeats = 20 requests. Plot visible stream gaps before/during/after the cold request and its own completion delay. Stop if no useful overlap occurred; fix orchestration offline rather than filling the allocation with retries.
A larger max_num_seqs is an alternative candidate only if pool/queue evidence supports it. Inspect its actual state allocation and compilation cost; increasing it does not itself establish more throughput. Choose one candidate before allocating the second session block. No automatic precision, reasoning or context sweep.
Session load and simulator validation
Use complete A/B profiles with 19 turns each. The four-session block contains two independent copies of each; the eight-session block contains four. Each copy gets a stable namespace across its turns, isolated from other copies. This represents unshared histories; any common-prefix-sharing study requires a separate declared cache policy. Audit tokens after all input construction. Repetition reduces content diversity and does not create independent task-quality observations.
For an overlap probe, launch the complete cohort at its declared starting time, retain the source’s assigned 1/10/30-second gap cycle, and show ramp-up and drain separately from the overlap window. Set the local client request limit to 16 for these runs; keep baseline engine sequences at eight and measure both client dispatch delay and server queueing. Session count includes agents in tools; inference concurrency counts active requests.
For a sustained alternative in the second block, maintain four active sessions by replacing each completion from a queue of eight complete histories. Report how long the four-session plateau actually lasted, and reserve enough time to finish the drain. A single finite eight-session wave is not steady state. Do not label any point capacity until the target active load is present long enough for meaningful context growth and returns; show sample counts, temporal windows and uncertainty.
For a candidate comparison use the first block’s four-session schedule twice in the second block, with comparable initial conditions and explicit arm order. This uses 152 requests and forgoes a new eight-session point. If an additional load point or sustained window is more informative, spend that block there and leave policy adoption open. Points at 12/16 active sessions and additional repositories are subsequent decisions, not funded defaults.
Freeze simulator parameters after diagnostics and predict a reserved window/load point before reading its result. Compare completions, queueing, return latency and replay work. A change in content alone does not validate congestion behavior. Until batching, reuse and eviction are modeled and this check passes, fleet outputs remain uncalibrated.
Exact public sources
Dataset: nvidia/Open-SWE-Traces; configuration v1.2; split opencode.
Shard: data/opencode/qwen38_27b/swe-rebench-v2/train-00000-of-00008.parquet.
Trajectory IDs: A 5abb6334-ea22-4df1-94fa-6701ca830e12; B 0ce6ffd4-ddf4-4591-ac67-49691543db95; C 30e0d1e8-85ef-49f3-bc40-9f90c546a040; D 42194551-26c1-4053-b052-ace692f2af98.
Selected profiles: A is josdejong/mathjs, task josdejong__mathjs-330, with 19 turns and 7,534–15,208 input tokens; B is nats-io/nsc, task nats-io__nsc-610, with 19 turns and 7,793–15,948 input tokens. These two complete histories have passed the canonical context audit. A has 18 length-eligible resumes; B has 17, with one 2,350-new-token resume reported separately.
Held-out profiles: C is PennyLaneAI/pennylane, task pennylaneai__pennylane-2947, with 23 turns; D is PyFilesystem/pyfilesystem2, task pyfilesystem__pyfilesystem2-470, with 16 turns. Their tool associations are checked, but their complete canonical context audits remain prerequisites. They are not used for tuning. If either fails the audit, we revise the frozen selection offline before allocating hardware; we do not trim or replace it during a run.
For content replay, we assign waits of 1, 10 and 30 seconds, repeating after successive responses. A and B each have 246 seconds of assigned waits across 18 resumes. Those waits are sensitivity assumptions, not recovered dataset timing. We save the complete request schedule and use it for both configurations.
Each assistant turn produces one request. Source and replay turn counts must agree. The final message must complete the source history, and every tool result must have an unambiguous call ID. Teacher success labels and reference patches are never evidence of our task success; reference patches are not sent to the model.
We render the entire request, including preserved reasoning, tools and message framing. On this worker, input plus the 2,048-token output allowance must fit 32,768 tokens: an input over 30,720 tokens is ineligible for this configured study. There is no silent context trimming or automatic compaction. A tokenizer/server count mismatch stops the session.
We are not importing Weka timing or subagent fan-out into these sessions. A separate timing corpus would add another workload and needs its own declared experiment. Our current scope is sessions, parallel tools and independent developers sharing one worker; it does not establish a subagent spawn/join workload.
C/D remain optional content-diversity checks requiring their audits and a request-for-request substitution recorded before allocation. They no longer stand in for a congestion validation point. Public replay never executes recorded commands. Live repository tasks execute the model’s own tools in an isolated fixture and run independent tests.
Budget and execution readiness
Historical planning allowance, not the final elapsed time: the additional allocation ceiling was 100 minutes. At the replacement VM’s published Netherlands on-demand rate of $11.88 per four-chip hour, that is $19.80 of TPU time. These are bounds, not an ETA or an invoice. We reserved $35 of the original $60 envelope for the earlier estimated usage and the replacement VM’s first period, leaving a conservative $25 planning limit for the restarted allocation. We still need the account’s actual charges.
Reserve at most 30 minutes for all startup/restarts/compilation, 3 for preflight, 5 for reuse, 10 for pressure, 6 for collisions, 26 for shared sessions, 6 for live/cancel checks and 2 for teardown: 88 minutes. The remaining 12 minutes are uncertainty allowance within the same 100-minute ceiling, not extra requests. Forecast each full block using measured generation and drain times. If it cannot finish within remaining time or credit, skip it and narrow the conclusion. No promise that the full plan fits; output length and compilation decide that.
The two-second drain offset replaces the old 120-second pressure timer. The old four 20-second idle controls are archived, not scheduled again. Cancellation checks request cleanup and released engine state, followed by recovery; a disconnected client alone is insufficient.
Metric definitions and evidence limits
We start the resume clock when the tool result is ready, before client dispatch or server queueing. TTFT is dispatch to the first generated event, including reasoning. Visible progress excludes reasoning that the client does not display. Next action is a complete valid tool call or complete final response; syntactic completion alone does not establish useful coding work. E2E ends when the response stream finishes. We save all four boundaries rather than substituting one for another.
A streaming stall is a gap over one second within a visible response, not the intended wait between tool turns. We report the stall fraction and its numerator/denominator. The first baseline is the reference; an acceptable company-wide stall rate and next-action budget are still open inputs, so this demo cannot silently certify them.
For the intermediate cost measure, a session earns latency-compliant completion credit only if all its planned turns finish with valid, untruncated actions and every length-eligible interactive resume produces visible progress within two seconds, whether cached or cold. This is a deliberately strict session measure, separate from the population p95. We also show per-turn goodput and all slow cases. Excluding cache misses from the warm-only chart must not make them disappear from this denominator. If no session earns credit, cost per compliant session is unavailable, not zero.
We count four chip-hours for each allocated slice-hour, including setup, failures and idle time, then divide by fully completed compliant sessions. Stage costs and the whole investigation cost are both shown; shared warmup/compilation is never silently omitted. Output tokens/s uses actual generated usage and an explicitly stated wall-time interval. Worker occupancy, sampled accelerator activity, logical cache reuse and allocated time are different quantities.
A result under one physical slice cannot establish independent-worker failover. Hundreds of correlated turns do not establish 99% production reliability. Record successful actions, failures, truncations, cancelled work, offered work that never dispatched and fully completed sessions. Quality remains the original model behavior plus live serving-regression checks; it is not inferred from teacher labels.
Deployment decisions that need no new inference
Inspect the pinned runtime/configuration for higher engine sequence limits, 64 Ki context support, TP=2 and precision support before any proposed run. A GPU feature documented upstream does not establish TPU hybrid support. BF16 TP=4 and 32 Ki remain this baseline; 64 Ki allocation/compaction requires its own decision and budget. We do not assume two TP=2 replicas fit or provide independent failure resilience.
Startup accounting joins VM boot, worker start, checkpoint load, compilation, ready endpoint and first generated event only where timestamps exist. Distinguish a full cold boot, process restart, durable checkpoint and temporary storage download. A missing timestamp stays unknown.
For the CPU economics view compare operating hours and all allocated workers, including idle/failure headroom, against uncached input, cached input, output and actual successful-task volume for a named API and reasoning tier. Fetch current on-demand/commitment/API rates when populating the table; do not apply an invented 35% utilization factor or mix a commitment price with pay-only-while-running assumptions. CPU projections require validated profiles first. Round-robin and affinity routing must model both cache loss and queue concentration; a 50–67% loss is not a consequence of replica count alone.
Local implementation status
All source stays under open-weights-llm. replay/causal.py implements the injected-provider loop that carries its own output and executor results forward; experiments/live.py runs the small real OpenCode fixtures. experiments/company.py is the complete fixed-work client, and simulator/run.py is the uncalibrated CPU queue model. The machine-readable protocol for this article is configs/experiment-plan.json.
The interactive trace panel is generated from the complete saved replay, not typed by hand. From the project root, run python blog/scripts/build_trace_walkthrough_data.py; it extracts the displayed per-turn clocks, token counts and output excerpts into the compact JSON resource used by both the trace and KPI widgets.
Our local checks include a 19-turn causal continuation, reversed parallel-tool completion, another developer served during a tool wait, actual file/test-process results, and failure/truncation accounting. They use a scripted provider and have a saved 31-test pass record. They do not measure the TPU.
.venv/bin/python -m unittest discover -s tests -v
.venv/bin/python -m simulator.run \
--output work/dry-runs/assumed-serial-queue.json \
--replicas 1 --assumed-service-s 1The second command intentionally uses an assumed one-second serial service time. Its output is for checking event/accounting logic, not for quoting a fleet size. That CPU example does not contact the model; the measured hardware runs described above use separate evidence directories.
The original readiness checklist recorded the following prerequisites; some have since been implemented and exercised in the runs above: audit the full C/D histories with the pinned canonical tokenizer; implement and test experiment-specific root/tool deadlines and cache namespace forwarding; prepare hybrid-pool attribution; and write the complete manifests and telemetry joins. Runtime support is then checked within bounded preflight. A failed prerequisite means that dependent experiment stays blocked, rather than becoming VM-side debugging with the clock left running.
The original plan is specified in configs/experiment-plan.json and docs/EXPERIMENT_TIMELINE.md. Later run manifests record the workloads actually executed. Request-level collision triggering and bounded pressure cohorts have since been implemented; a validated multi-worker routing model remains outside the evidence reported here.
Earlier evidence and corrections
The first adapter capped histories at four turns and stopped at ambiguous parallel results. All 12 selected sources were shortened to three or four turns; one source had 219 assistant turns. The earlier 1×/2×/4× latency-throughput points therefore remain short-prefix diagnostics, not company-capacity or long-session cache-pressure evidence.
We also found that the chat endpoint normalized legacy reasoning_content to reasoning, while the separate tokenizer path did not. The token audit undercounted preserved thinking. Canonical normalization fixes that discrepancy, and a runtime count check now rejects a mismatch. A 27-turn candidate then needed 31,047 input tokens plus 2,048 output tokens: 33,095, beyond the worker limit. We stopped it at 26 turns and marked it incomplete.
The replacement A replay passed 19/19 turns and reached 15,208 input tokens. We retain the old records and correction files. They are not input to a new fleet claim.
What can we offer the company so far?
Let’s return to the original request: give 100 engineers a useful coding service within a modest hardware budget. We now have measured behavior from a shared slice, rather than just a working endpoint. The scorecard below records what we can support with that evidence today. It brings the measured outcomes and their deployment implications together.
For a concrete reference, we use the completed four-session, cache-disabled run with the original 8,192-token batch budget. This keeps the latency, streaming and completion figures tied to one workload. Its four recorded histories contain 76 model turns with assigned tool waits. The eight-session result is a separate load point; neither wave represents 100 engineers continuously requesting inference.
| Objective | Measured result | What we can conclude |
|---|---|---|
| Preserve the selected model’s coding behavior | Medium reasoning, BF16 and full eligible histories retained. Small live tasks passed preserved tests through the actual tool loop. | Serving integration checks passed on these fixtures. Published model quality remains our reference; this is not a representative task-success or developer-acceptance rate. |
| Resume promptly and deliver a complete next action | Reference wave: 35/70 eligible resumes visible within two seconds; eligible visible p95 4.56 s, including client token auditing. | After excluding initial turns and resumes with more than 2 Ki new input, 35 of 70 length-eligible resumes became visible within two seconds; their sample p95 was 4.56 s. Caching was disabled, so this measures cold eligible resumes. It does not establish the warm-cache target. |
| Keep streaming smooth | 1 of 76 responses (1.3%) had a visible chunk gap longer than one second in the reference wave. | This is the observed stall fraction for this workload. An acceptable company stall rate has not yet been agreed. |
| Complete offered work at peak demand | Reference wave: 76/76 turns, four complete sessions. Separate eight-session wave: 152/152 turns, eight complete sessions. | Both finite waves completed. They do not establish the proposed 99% production reliability target, a sustained busy-hour capacity, or survival of a worker failure. |
| Use the least compute for the required experience | Reference wave spanned 315.2 s from first dispatch to last response: about 0.350 chip-hours, or 0.088 chip-hours per completed replay session. At the stated $11.88 slice-hour rate, that interval corresponds to about $0.26 per completed replay session. | This interval excludes startup and surrounding idle time, so it is a workload-level reference, not the total service cost. None of the four sessions met the strict rule that every eligible resume must stay within two seconds, so cost per compliant session is unavailable. Full investigation allocation is reported below. It is not cost per successful coding task. |
Our recommendation is a controlled pilot. The service can complete the tested workload, but the tail of the resume distribution needs attention before we promise the same experience to the whole company. The next serving decision should be driven by those slow resumes, with the model’s reasoning and history preserved.
The load increase matters to the recommendation. At eight overlapping sessions, all turns completed, but median visible progress rose to 2.82 s, sample p95 to 7.55 s, and 4 of 152 responses (2.6%) had a visible stall. We should not offer the company a capacity number based only on requests finishing; the experience changes before the service starts failing.
Our current recommendation is to treat this as a measured pilot configuration. We have a working tool loop and evidence for how sharing affects responsiveness. Before recommending a fleet for all 100 engineers, confirmed warm-cache load behavior and sustained peak demand remain open inputs. The final pressure probe did demonstrate loss of reuse and recovery, with about 1.04 seconds of additional visible wait in that single comparison. The corrected simulator passed its fresh four-session check: median, tail and duration errors were about 23.5%, 17.9% and 8.1%, within the predeclared 25% limit. That supports this workload-level check; further load and routing validation is needed for a multi-worker recommendation. For this pilot, the measured baseline is BF16, medium reasoning, TP=4 and a 32 Ki context limit. The shared-load results use caching disabled; the patched cache-enabled worker has passed the smaller concurrency and pressure probes, but has not repeated the shared-load qualification. That is the next configuration comparison before a company rollout.
The offline eligibility check makes the service decision clearer. The four-session reference completed every turn, but only half of its 70 length-eligible resumes became visible within two seconds. The eight-session wave reached that budget on 36 of 140 eligible resumes. No session in these waves kept every eligible resume within the strict two-second session budget. We therefore cannot turn the low interval cost per completed session into a cost per session meeting that experience target.
Across the recorded allocations, the estimated investigation compute cost through 2026-11-28 10:52:13 UTC is $67.46, including setup, idle time, failed runs and restarts. This combines the earlier Tokyo estimate with the replacement VM’s recorded allocation periods at published on-demand rates. GCP confirmed the VM stopped at that cutoff. This estimate excludes storage and other services and has not been reconciled against the account’s actual charges.