← all posts
October 5, 2026·Ronald Adonyo· 12 min read

Per-request LoRA swapping on AMD: a local decision judge one row behind hosted Jev

vLLM-Radiance now serves decision adapters: one 27B base model, adapters chosen per request and loaded while it runs (558 ms for a 218 MB adapter, 1.28 s for the 451 MB JEV-27B) and removed in 2.6 ms. AutoTrust's JEV-27B scores 112 of 135 labelled judgments locally against 113 for the hosted service. Four patches got it there, three of them linked.

InfrastructureAIvllmrocmLoRAspeculative-decoding
A low stone cabinet on a bench at dusk holding one large dark block and a row of thin slates in slots; a gorilla sits with a hand resting on the cabinet, a chimpanzee slides a slate into a slot and a crested crane at the right looks at it, with a lit oil lamp and the lake behind.

vLLM-Radiance is the build of vLLM that runs MXFP4 models on AMD's R9700 cards. Until this week it could not serve a decision adapter: a LoRA that turns a general model into a fast yes/no judge. It can now. One serve holds one 27B base model, and each request chooses the base model or any loaded adapter by name. Adapters load while the serve keeps running, in 558 ms for a 218 MB adapter and 1.28 s for the 451 MB JEV-27B, and unload in 2.6 ms. The public AutoTrust JEV-27B adapter, served this way, got 112 of 135 labelled judgments right. The hosted service it comes from got 113 on the same rows.

It took four patches: three to vLLM and one to the adapter loader. The three vLLM ones are downloadable at the end of this post. One of them exists because a test request took the serve down for 13 minutes.

Why bother

An agent that runs for hours keeps making small choices. Is this tool call worth making? Did that step fail? Is the claim in this summary backed by something it actually ran? Asking a large model to reason about each one is slow. A decision adapter answers in one token: the model reads the situation and a question, and the probability it puts on the word "true" is the answer.

AutoTrust publishes one such adapter for the Qwen 27B family this bench already serves, under Apache-2.0, and runs a hosted version called Jev. Hosted is fine until the rows being judged are private agent traces. The goal here was the same judge on local hardware, on the serve that is already running, without giving a second pair of GPUs to a second copy of the model.

one serve, one base modelQwen 3.8 27B, MXFP4, 2 GPUsweights stay in memory throughoutbase modelrequest names the base: 206 ms per decisiondecision adapter (JEV-27B)request names it: 261 ms per decisionany other adapter, up to 8218 MB: loaded in 558 ms, removed in 2.6 mseach request picks its own row
What the patched serve does: each request picks the base model or an adapter, and the third adapter is loaded, answers, and is removed while the serve keeps running. Timings are from the tables below.

The bench

Every number in this post was measured on this machine, on 2026-10-04 or 2026-10-05 as marked.

partvalue
MotherboardASRock Rack ROMED8-2T/BCM (rev 3.01), BIOS P4.10 (2025-06-05)
CPUAMD EPYC 7532, 1 socket, 32 cores / 64 threads, max 3.31 GHz, 1 NUMA node
Memory320 GB DDR4: 4 x 64 GB rated 2400 and 2 x 32 GB rated 2133, all configured at 2133 MT/s (314 GiB visible)
GPUs4 x Radeon AI PRO R9700, 32,624 MiB each; the serve uses two (tensor parallel 2), capped at 250 W
OSPop!_OS 24.04 LTS, kernel 7.1.5 with local patches
Kernel flagsiommu=pt amd_iommu=pt amdgpu.runpm=0 amdgpu.dc=0 amdgpu.ppfeaturemask=0xfff3ffff
RuntimevLLM-Radiance image (vLLM 0.27.1), ROCm 7.2.4, torch 2.11.0+rocm7.14, Triton 3.6.0
PSU, risers, storagenot recorded

PCIe link state per card, from pp_dpm_pcie (the starred row is the active state) and each root port's AER counters:

GPU  03:00.0  16.0 GT/s x16  root 02:00.0  0 correctable errors
GPU  47:00.0  16.0 GT/s x16  root 46:00.0  0 correctable errors
GPU  83:00.0  16.0 GT/s x16  root 82:00.0  0 correctable errors
GPU  c4:00.0  pp_dpm_pcie prints no active row  root c3:00.0  0 correctable errors

The sysfs file current_link_speed reads "32.0 GT/s" for all four cards on a Gen4 board, so it is wrong here and the pp_dpm_pcie value is the one reported. The card at c4:00.0 prints no active row. It is one of the two cards the serve used on 2026-10-04. That is a finding, and it is not explained here.

Swapping adapters on a running serve

vLLM already has the API for this. The serve starts with --enable-lora, and two endpoints add and remove adapters afterwards. A request then names the adapter in its model field, exactly as it would name a model.

# add an adapter to the running serve
curl -s "$VLLM_URL/v1/load_lora_adapter" -H 'Content-Type: application/json' \
  -d '{"lora_name": "jev-decision", "lora_path": "/adapters/jev-27b"}'

# use it: the model field selects it for this request only
curl -s "$VLLM_URL/v1/completions" -H 'Content-Type: application/json' \
  -d '{"model": "jev-decision", "prompt": "...", "max_tokens": 1}'

# remove it
curl -s "$VLLM_URL/v1/unload_lora_adapter" -H 'Content-Type: application/json' \
  -d '{"lora_name": "jev-decision"}'

Measured on 2026-10-04 with a 218 MB adapter, with the container id and start time identical before and after:

steptimenote
load a second adapter558 msHTTP 200; it then appears in /v1/models
first request that selects it120 msinside the warm range below, so no compile on first use was seen
20 warm requests, same short promptp50 117 ms, p95 153 msone prompt, so this is a floor
unload2.6 msit disappears from /v1/models
base model straight after the unload77 mssame answer as before
load JEV-27B (451 MB, 2026-10-05)1.28 sno graph recompile

Serving through an adapter is not free. The cost depends on how many tokens are generated, so here are both ends: a 128-token generation and a one-token decision.

workloadbase modelthrough an adapter
128 generated tokens, p50 wall time500 ms (256 tok/s)942 ms (136 tok/s)
one-token decision over 135 rows, p50206 ms261 ms

The generation row is 20 measured requests after 3 warm-ups, one client, speculative decoding on, and throughput is completion tokens over client wall time, so it includes prompt processing. Two cautions. Other clients were using the serve during the run. And it was measured on 2026-10-04, before the naming bug described below was found, so that adapter's layer weights were being zeroed: the row measures what the adapter path costs a request, not what any particular adapter does. The decision row is one pass per model on 2026-10-05 with the fixed loader.

Requests that stay on the base model pay little for adapters sitting loaded beside it. The base ran at 245 tok/s with one adapter registered and 272 tok/s with none. Those two runs were sequential on a live serve, so the 10% gap is an observation. It does not establish a fixed overhead.

What was in the way

The swap API worked on the first try. Getting a decision adapter to give correct answers through it did not. Four separate things were wrong, and only two of them announced themselves.

#symptomcausefix
1adapter load refused, HTTP 500vLLM's Qwen3.5 classes do not list lm_head as a LoRA targetone line on each class
2adapter loads, output identical to basetensor names match no module; vLLM zeroes them silentlyloader renames them, refuses a zero-match adapter
3one request kills the enginea Triton kernel does not compile on the AMD backendported kernel plus a torch fallback
4works for 1 token, HTTP 500 for 2 or morethe speculative path drops the requested token idssix replacements in the rejection sampler

1. The output head was refused

A LoRA is a small set of extra weight matrices added to chosen layers of a base model. Most adapters touch the attention and feed-forward layers only. A decision adapter also adapts lm_head, the last layer, which turns the model's hidden state into a score for every token in the vocabulary. That is where the two answer words get pushed apart.

vLLM accepts lm_head as a target only when the model class lists it in a field called embedding_modules. The two classes this model loads through, Qwen3_5ForCausalLMBase and Qwen3_5ForConditionalGeneration, declare none. The load failed:

expected target modules in {...} but received ['language_model.lm_head', ...]

The machinery to apply a LoRA to the head is already in vLLM 0.27.1. Only the declaration was missing:

embedding_modules = {"lm_head": "output_embeddings"}

2. The adapter that loaded and did nothing

This one cost the most time, because nothing failed. On 2026-10-04 a different adapter loaded cleanly, appeared in /v1/models, and answered requests. Scored against the base model on the 135 rows, every predicted label matched and the largest difference in probability was 1.7 billionths. The adapter file was not empty: 800 tensors, all non-zero.

The names were wrong. Both adapters' tensors are named base_model.model.model.layers.*, the form used by a text-only model. The class vLLM uses here is the vision-capable one, and it holds the same layers one level down, at ...model.language_model.layers.*. vLLM sets any adapter tensor whose name matches no module to zero, and says nothing. Registration, selection and timing all looked normal.

The loader that prepares adapters for this serve now renames the keys to the wrapped path, and stops with an error if an adapter's keys match no module at all. That second check is the one worth copying: an adapter that matches nothing is never what anyone meant.

3. One request, 13 minutes down

To read a decision, the client needs the log-probability of two specific tokens, "true" and "false". The usual way is to ask for the 20 most likely tokens and hope both are among them. On this adapter they usually were not: that read-out could decide only 28 of the 135 rows. vLLM has a parameter for exactly this case, logprob_token_ids, which returns the log-probability of whichever token ids the request lists.

The first request carrying it killed the serve, from 14:27:19 to 14:40:31 UTC on 2026-10-05. The agent session running this work sent it, and had called it a read-only probe. It changed no state. It was also the first time that code path had ever run on this serve, and that, not read versus write, was the risk.

vLLM writes part of its sampler in Triton, a language that compiles small GPU functions the first time they are used. The function _fill_logprob_token_ids_kernel in vllm/v1/worker/gpu/sample/logprob.py did not compile on Triton's AMD backend:

triton/backends/amd/compiler.py  make_ttgir
RuntimeError: PassManager::run failed

The exception surfaced inside the worker, where nothing catches it, and took down the process that owns the model. The port changes two things in the kernel and adds a guard:

originalport
a runtime branch that picks one of two pointer basestwo masked loads, combined with tl.where
a tl.int1 store into a bool tensora uint8 buffer, converted with .bool() afterwards
a kernel failure is fatallogged once; a plain-torch twin of the kernel takes over

A probe run inside the serve container builds both versions and compares them:

{"triton": "ok", "torch": "ok", "equal": true, "triton_version": "3.6.0"}

The two kernel changes went in together, so which of them the AMD compiler was rejecting is not isolated. The fallback is the part that matters for anyone else: a read-out feature should not be able to stop the engine.

4. It worked for exactly one token

After the port, max_tokens=1 returned the requested ids. Anything longer returned HTTP 500, "list index out of range", 7 times out of 7. The same requests without the ids succeeded.

The serve uses speculative decoding: a small drafter proposes several tokens ahead, and the main model checks them in one pass and keeps what it agrees with. That gives vLLM two sampling paths. The first token of a response is sampled normally. Every later token is a draft being verified, and the verifier had never been taught about requested ids.

token 1tokens 2 and laterrequestlogprob_token_idssamplerSampler.__call__scores for the idscompute_topk_scoresids returnedmax_tokens=1 workssame requestlogprob_token_idsrejection samplerRejectionSamplerreturns None_get_logprobs_tensorsHTTP 500list index out of rangeids dropped herethe ids were never handed to the scoring step, and plain top-k is switched off forrequests that carry ids, so nothing was left to returnids
The two sampler paths before the fix. With speculative decoding on, only the first token of a response uses the top path. In motion: the first token carries its ids to the end; a later token arrives with them, loses them at the rejection sampler, and ends in the error.

Sampler.__call__ passes the request's token-id state to compute_topk_scores. The RejectionSampler did not, and vLLM turns ordinary top-k off for requests that carry ids, so its _get_logprobs_tensors had nothing to return and returned None. The API server then indexed a list of log-probabilities shorter than the list of tokens.

AutoTrust had hit this first. Their serve_decide.py carries a comment saying that logprob_token_ids does not work with speculative decoding "in this vLLM build", and that comment is what pointed at the rejection sampler. The fix is six replacements that make it mirror the sampler: the batch-wide id width, ids alone being enough reason to return log-probabilities, and the chunk's expanded index mapping. After it the ids come back on every token at 1, 2, 3, 12 and 64 tokens, with and without top-k, and plain generation is unchanged.

Decisions only need one token, so why fix the multi-token case? A parameter that works at one token and returns a 500 at two is a trap for the next person, and the serve should not have to turn speculative decoding off to host a judge. Tested under DFlash at 7 speculative tokens. Not tested under MTP.

The dataset

135 yes/no judgments, each about one turn an AI coding agent took during a real internal working session. A human labelled each one against a rubric with three behaviours the agent is supposed to show:

rubric behaviourrowswhat a true label means
check-first61the agent gathered information before acting
handle-failure42the agent dealt with a failure instead of walking past it
honest-claim32the agent's claim was backed by something it had run

68 rows are labelled true and 67 false. Each row carries the agent's state, the proposed turn and one question, and the prompt that results is 278 to 830 tokens long (median 500). For every row the hosted service's probability had already been stored, which is what lets the comparison below avoid calling it again. The set is small, which is why every figure here is a count out of 135 as well as a percentage, and one row is 0.74 points.

It is a rubric corpus, not a sample of what an agent encounters. It was never meant to represent how often an agent chooses a tool, drops a call or routes between models, and nothing here measures that. The rows contain internal traces and are not published, which is why the comparison to hosted Jev uses stored probabilities and not a fresh call. Neither the adapter nor the calibration was tuned on these rows by this work.

Against hosted Jev

Each row is one /v1/completions call for one token, using the adapter's own prompt format (jev27-bare-v1). The probability of "true" comes from the two requested token ids, plus the head bias the adapter ships, over its calibrated temperature of 1.0143.

judgecorrectaccuracyp50 per decision
JEV-27B adapter on the local serve112 / 13582.96%261 ms
hosted Jev, same rows113 / 13583.70%not measured
base model, same prompt, no adapter67 / 13549.63%206 ms

One row apart. The local adapter and the hosted service agree on 120 of the 135 rows, so they are not making identical calls: each gets some rows the other misses. The local errors lean one way, 18 trues missed against 5 falses called true. The base model's 49.63% is not a judge at all. It answered "false" on every row, and 67 of the rows are false.

The hosted column uses the probabilities the service returned when these rows were first judged. It was not called again, because calling it means sending internal agent traces to a third party, which is the thing this work exists to avoid. That is also why there is no hosted latency in the table. A speed comparison against Jev needs a public row set, and that has not been done.

Local latency is p50 261 ms and p95 375 ms per decision, one client, sequential, 3.67 rows a second. A second pass through a small decision endpoint placed in front of the serve gave the same 112 of 135 and a p50 of 257 ms. Two passes is not a warm floor, and no concurrent throughput was measured.

The patches

Each script holds the SHA-256 of the vLLM 0.27.1 file it expects and of the file it produces, and refuses anything else. Nothing is rebuilt: copy the file out of the image, patch the copy, and mount it back read-only.

scriptvLLM file it patcheswhat it does
patch_vllm_qwen3_5_lm_head_lora.pymodel_executor/models/qwen3_5.pydeclares lm_head as a LoRA target
patch_vllm_logprob_token_ids_rocm.pyv1/worker/gpu/sample/logprob.pyports the fill kernel to AMD Triton, adds the torch fallback
patch_vllm_spec_logprob_token_ids.pyv1/worker/gpu/spec_decode/rejection_sampler.pyreturns requested ids under speculative decoding
probe_logprob_token_ids_kernel.pynonebuilds the kernel and its twin in the container and compares them
probe_spec_logprob_token_ids.pynoneruns the patched scoring call on expanded logits

Download: lm_head target, ROCm kernel port, speculative decoding, kernel probe, speculative probe.

# 1. copy the file out of the image you run
SP=$(docker run --rm --entrypoint python3 "$IMAGE" -c 'import vllm, os; print(os.path.dirname(vllm.__file__))')
docker run --rm --entrypoint cat "$IMAGE" "$SP/v1/worker/gpu/sample/logprob.py" > vllm_sample_logprob.py

# 2. check it is the file the script expects, then patch the copy
python3 patch_vllm_logprob_token_ids_rocm.py --check vllm_sample_logprob.py
python3 patch_vllm_logprob_token_ids_rocm.py --apply vllm_sample_logprob.py

# 3. mount it over the original when starting the serve
docker run ... -v "$PWD/vllm_sample_logprob.py:$SP/v1/worker/gpu/sample/logprob.py:ro" "$IMAGE" ...

Run the kernel probe inside the container before sending a real request. That is the step that was skipped the first time. The adapter loader with the key renaming is not published yet; the rule it implements is in section 2 and fits in a dozen lines. None of this has been sent upstream yet. The lm_head declaration and the rejection-sampler change are not specific to AMD and belong in vLLM itself.

Settings

itemvalue
Adapterautotrust/JEV-27B on Hugging Face, Apache-2.0, revision 51740a8891c2a8baefd969237fd44187b3e3a115
Adapter shaperank 32, BF16, 802 tensors (800 layer tensors plus lm_head A/B), 451,489,776 bytes
Adapter sha25679f691c1fd127157d0fb14cb9dd0aa2f91eddd8047368fd4551348f561871682
Base modelQwen 3.8 27B, MXFP4, FP8 KV cache
Topologytensor parallel 2, DFlash speculative decoding, 7 speculative tokens
--max-model-len 262144 --max-num-seqs 8 --gpu-memory-utilization 0.97
--enable-lora --lora-dtype bfloat16 --max-lora-rank 64 --max-loras 8

The decision request, one per row:

{
  "model": "jev-decision",
  "prompt": "<the adapter's native prompt for this row>",
  "max_tokens": 1,
  "temperature": 0,
  "logprobs": 1,
  "logprob_token_ids": [<false id>, <true id>],
  "add_special_tokens": false,
  "return_tokens_as_token_ids": true
}

What is not known

Hosted Jev's latency, and so any speed comparison with it. Throughput with several clients at once, and whether mixing adapters in one batch costs more than the single-client numbers suggest. Which of the two Triton changes fixed the build. Whether the rejection-sampler patch holds under MTP. Why the card at c4:00.0 reports no active PCIe row. And why, at temperature 0, the same prompt's log-probability for the sampled token moved between runs: -5.38, -5.51, -5.59.

Credit

The adapter, its output head and its calibration are AutoTrust's, published as autotrust/JEV-27B. Their comment in serve_decide.py named the speculative-decoding gap before this work reached it. vLLM-Radiance is StillDeadcode's work, and it is the build this serve runs. The LoRA endpoints, the sampler and the kernel being patched are the vLLM project's.

Corrected 2026-10-10: the summary said adapters load in 0.56 s and unload in 3 ms. The load (558 ms) and the 2.6 ms unload were measured on a 218 MB adapter; the 451 MB JEV-27B adapter this post is about loaded in 1.28 s. The summary now gives both.

A wide horizon at dusk: layered hills in muted plum and ochre above a lake that holds the last light, a family of crested cranes at the water's edge, an acacia in silhouette and a single bright star above the ridge.