neuron-explorer
Steering-first neuron explorer for Qwen3.5-4B: push every MLP neuron, keep every rollout, browse the results
翻譯準備中
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證A conformance test suite for OpenAI-compatible LLM gateways -- streaming, usage, cost, concurrency, and error-propagation checks against a deterministic mock upstream.
翻譯準備中
取自儲存庫 README
正在載入完整 README。 以下為已儲存的摘錄。
A conformance test suite for OpenAI-compatible LLM gateways — catches streaming, usage, cost, concurrency, and error-handling bugs that an eyeball review of a diff won't.檢視完整 README ↗A conformance test suite for OpenAI-compatible LLM gateways — catches streaming, usage, cost, concurrency, and error-handling bugs that an eyeball review of a diff won't.
An LLM gateway (LiteLLM and its many peers) sits between your application and whichever model provider you're actually calling — OpenAI, Anthropic, a self-hosted model, whatever. Its job is to make all of them look the same to your app: one API shape, provider-agnostic. To do that, on every single request it has to: re-stream the model's response chunk-by-chunk back to you, recompute how many tokens were used, calculate what that request cost, and correctly propagate any upstream failure. That's a surprising amount of stateful, timing-sensitive logic sitting directly in the hot path of every request your app makes — exactly the kind of code that's easy to get subtly wrong.
Why this is dangerous specifically because it's subtle. A gateway that drops the last chunk of a streamed response still looks like it worked in a quick manual test — you'd have to notice the response was one word shorter than it should be. A gateway that miscalculates cost still returns a number; you'd only notice it was wrong when your bill didn't match your usage. A gateway that swallows an upstream error and reports finish_reason: "stop" anyway looks, to your application, exactly like a successful, complete response. None of these announce themselves. They show up in production, under load, as a wrong invoice or a user complaining about a truncated answer nobody can reproduce on demand.
There was no independent, reusable way to check for this class of bug before deploying a gateway (or a change to one). Every project either trusted the gateway's own test suite or found out the hard way. gatewayproof is a standalone answer: a deterministic mock model, and a battery of checks any OpenAI-compatible gateway can be run against.
You can't point this at a random live gateway and expect a useful answer, because there's no ground truth to compare against when the actual model is involved — you don't know in advance what a real LLM "should" say. Instead:
gatewayproof starts a mock upstream that speaks the same /v1/chat/completions API a real provider would, but every response is scripted ahead of time: you (or the checks) tell it exactly what content, token usage, and timing to produce for a given request. This is the "ground truth."api.openai.com.gatewayproof sends requests through your gateway, not directly to the mock, and compares what comes back against the ground truth the mock scripted — catching anything the gateway added, dropped, or miscalculated on the way through. gatewayproof checks ──requests──> [ gateway under test ] ──requests──> mock upstream (ground truth)
<──responses── <──responses──
| Check | The bug it catches |
|---|---|
streaming-fidelity | A dropped, duplicated, or reordered chunk mid-stream — the streamed response, reassembled, doesn't match what a non-streamed call to the same request would return. |
usage-accuracy | Wrong prompt_tokens / completion_tokens / total_tokens, in either a streamed final chunk or a non-streamed response body. |
cost-accuracy | A wrong cost calculation. Reads whatever the gateway reports as cost (defaults to LiteLLM's x-litellm-response-cost header, pluggable for others) and checks it against usage × your pricing table. |
concurrent-isolation | Content from one concurrent request leaking into another's stream — a real bug class in gateways that multiplex several streams over shared internal state. |
error-propagation | The single worst failure mode: an upstream error mid-stream getting reported to the caller as a clean finish_reason: "stop", which looks exactly like success. |
Every check is independent, so a gateway can fail one without failing the others — the report tells you specifically which promise was broken.
# 1. Pick a fixed local port and configure your gateway's upstream to point at it
# (e.g. http://127.0.0.1:5055) -- then start your gateway.
# 2. Run the suite. It starts the mock upstream on that exact port, then hits your gateway.
npx gatewayproof run --target http://localhost:4000 --mock-port 5055
Mock upstream: http://127.0.0.1:5055
Target gateway: http://localhost:4000
PASS streaming-fidelity -- Streamed content matches non-streamed content, with no drops, dupes, or reordering
PASS usage-accuracy -- Reported token usage matches the upstream's actual usage
FAIL cost-accuracy -- Reported cost matches usage x the supplied pricing table
expected cost 0.00019999999999999998, got 0.000001
PASS concurrent-isolation -- Concurrent streamed requests never leak content across streams
PASS error-propagation -- A mid-stream upstream failure surfaces as an error, never a silently-truncated success
4/5 checks passed.
Exit code 0 on all-pass, 1 otherwise.
- name: Start your gateway
run: |
# your gateway, configured with upstream = http://127.0.0.1:5055
my-gateway serve --port 4000 &
sleep 2
- name: Run gatewayproof against it
uses: jayblast-spec/gatewayproof@main
with:
target: http://localhost:4000
mock-port: '5055'
For a self-contained test where you control the gateway's lifecycle directly (e.g. testing your own gateway's code in its own test suite):
import { startMockUpstream, runChecks } from "gatewayproof";
const mock = await startMockUpstream(5055); // fixed port your gateway is already configured against
const gateway = await startMyGateway({ upstreamUrl: mock.url });
const report = await runChecks({ targetBaseUrl: gateway.url, mock });
console.log(report.passed, report.results);
await gateway.stop();
await mock.stop();
npm install --save-dev gatewayproof
npm install
npm run typecheck
npm test
npm run build
npx tsx examples/demo.ts # runs the suite against a correct fixture and a deliberately buggy one
MIT
This is one of 8 independent open-source infrastructure tools, each built against a real, researched gap:
Built by ArkNet Digital.