Bounding a 70B Reader Behind Sherlock Username Checks
Bounding a 70B Reader Behind Sherlock Username Checks At 3:00 AM the page is not a remote site. The username checks already finished. A 70B reader reserved a default KV window, offloaded early layers to host RAM to mak
Bounding a 70B Reader Behind Sherlock Username Checks
At 3:00 AM the page is not a remote site. The username checks already finished. A 70B reader reserved a default KV window, offloaded early layers to host RAM to make room, and OOM'd once the queue was warm. Throughput had collapsed while the card still looked fine at process start.
I do not maintain sherlock-project/sherlock. I run it in front of a pipeline that turns public username existence checks into a short brief on hardware I control. Each site entry carries a URL template and a presence rule. Workers issue the HTTP calls. A classifier marks the username found, missing, or unknown. That artifact is bounded JSON. Reading the hits is a separate stage.
The checker stays stateless and network-bound. It must not store HTML bodies, and it must not call a model. The reader takes one truncated evidence block per username and writes a few lines: which hits are consistent, which are noise, what a human should open. One concatenated campaign is how a fast fan-out becomes an unbounded prompt.
A tutorial pastes a single name into ollama run. Production is a couple hundred usernames with positive and ambiguous sites, joined into one prompt at the model default. Weights fit on an 80GB GPU. KV cache still reserved the full sequence length. Offload did not shrink that reservation. Prefill got slower while the GPU held a long pool. Prefix caching stayed on without a shared prefix, and blocks lived on because every hunt was appended to one session. Early requests succeeded. Later the allocator returned OOM. The cause was context length, layer offload, and KV retention.
Refuse the long prompt. Drop state after every username. One user per request. JSON stays the source of truth. If the block will not fit, fail that username closed: log it, do not widen the window, and do not retry on the same process.
vllm serve meta-llama/Meta-Llama-3.1-70B-Instruct \
--host 127.0.0.1 \
--port 8000 \
--max-model-len 4096 \
--gpu-memory-utilization 0.88 \
--kv-cache-dtype fp8 \
--max-num-seqs 4 \
--enable-chunked-prefill
max-model-len 4096 rejects oversized evidence instead of admitting it into a cache that fails once the queue is warm. kv-cache-dtype fp8 keeps four sequences resident. max-num-seqs 4 blocks a burst that only fits an empty allocator. Chunked prefill holds time-to-first-token down when one block is still a couple thousand tokens. CPU layer offload stays off. It hid the real budget and brought the leak back under a long run.
Four thousand tokens will not hold a noisy username's full story. A 32k second pass is only for names that already show several positive hits. FP8 cache is slightly lossy. On briefs of a few hundred output tokens the label has not changed for me. Past about 0.92 gpu-memory-utilization, fragmentation kills a later request the average still claimed would fit. A tight max-num-seqs serializes the reader on purpose. The checker can finish first. The queue should say so.
I measure the reader, not the fan-out. TTFT is send until the first streamed chunk. Latency is full completion. The sample client does not buffer the stream into a growing string.
import asyncio, time, aiohttp, json
URL = "http://127.0.0.1:8000/v1/chat/completions"
PAYLOAD = {
"model": "meta-llama/Meta-Llama-3.1-70B-Instruct",
"stream": True,
"max_tokens": 256,
"messages": [
{"role": "system", "content": "Summarize public username hits. Stay inside the evidence."},
{"role": "user", "content": "github=found, gitlab=found, medium=unknown. Three lines."},
],
}
async def one(session):
t0 = time.perf_counter()
ttft = None
async with session.post(URL, json=PAYLOAD) as resp:
async for raw in resp.content:
if not raw.strip():
continue
if ttft is None:
ttft = time.perf_counter() - t0
if raw.startswith(b"data: [DONE]"):
break
return ttft, time.perf_counter() - t0
async def main():
async with aiohttp.ClientSession() as session:
samples = await asyncio.gather(*[one(session) for _ in range(8)])
ttfts = sorted(s[0] for s in samples if s[0])
lats = sorted(s[1] for s in samples)
print(json.dumps({
"ttft_ms_p50": ttfts[len(ttfts)//2] * 1000,
"lat_ms_p50": lats[len(lats)//2] * 1000,
"n": len(samples),
}))
asyncio.run(main())
When I want an external latency number on that same truncated prompt, I point the identical payload at B-Lost's relay gateway (baseURL https://b-lost.com/v1) and record TTFT next to the local samples. It is a baseline for nights when the GPU is shared. It is not the path for Sherlock evidence. Hit metadata stays on the machine that ran the check.
A site omitted from the snippet is omitted from the brief, so JSON remains authoritative and the model is only a reading aid. A fresh request per username matters more than any cache flag. Append every hunt to one chat and the KV leak returns, fp8 or not. Sherlock keeps checking public URL templates. The 70B reads a short block, then drops the sequence.
The hard trade-off is the window. Short context throws away correlation. Long context invites the allocator back at the worst hour. I would rather ship a brief that admits a gap than rebuild a half-dead cache after OOM.
Where did you pin context length for a large reader behind a fan-out checker, and what broke first when one session ate the whole campaign?
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.