rerank-acme-api.kernel.run
feat/rerank9c21d07 feat(rag): rerank with bge-small on fra-g2
- +
- RERANK_MODEL=bge-small
- ~
- KV_NAMESPACE=preview-218
- -
- LEGACY_SEARCH=1
- 142 tests
- type-check
- p95 62 ms
Kernel is one runtime for functions and AI inference. Push once and it boots in under 5 ms in 312 cities, runs models on GPUs in 48 regions, scales to zero and bills by the millisecond.
Illustration: the Kernel processor package, a square substrate with a 4 by 4 grid of lime compute cores under a metal heat spreader, drawn in ASCII characters. Moving the pointer over it reveals the solid render underneath.
Running in production at
[02] / DEPLOY
git push to 312 cities in 11 seconds.Kernel builds your functions and diffs your model weights, then swaps every city to the new version at once. No regions to pick, no warm pools to babysit.
Example deploy transcript: after a git push of the feat/rerank branch, the command kernel deploy detects a TypeScript project with one model, builds in 1.8 seconds, uploads 4.6 MB of changed model weights, rolls the preview out to 312 cities across five regions and is live in 11.4 seconds at rerank-acme-api.kernel.run, ready to promote to production.
feat/rerank9c21d07 feat(rag): rerank with bge-small on fra-g2
Each push gets its own URL, its own secrets and a copy of production KV, so reviews run against real data shapes.
Old and new versions never mix. All 312 cities flip within 400 ms of each other, and in-flight requests finish on the old code.
Fine-tuned a LoRA? We upload the 4.6 MB that changed, not the 4.9 GB model, and warm it on the GPUs that serve it.
kernel rollback restores the previous build everywhere in under two seconds. The last 50 builds stay hot.
[03] / PLATFORM
Functions
V8 and WASM isolates start in 4.2 ms at p50, share nothing and run in every city by default. Node APIs, streaming responses, WebSockets and cron.
cold start, last 24 h 0-3 ms ####################### 71% 3-5 ms ####### 22% 5-10 ms ## 6% >10 ms # 1%
Inference
L4 and H100 capacity in 48 regions. Bring weights as safetensors, GGUF or ONNX, or pick from 140 open models. First token in 180 ms, zero cost while idle.
Is ticket #4182 a duplicate?
Yes. #4182 reports the same 502 on /checkout as #4102, from the same deploy, so I merged them and linked the fix.
ttft 178 ms212 tok/s$0.00004
Data
Global KV with read-your-writes, durable queues and a vector index that lives next to the model, so retrieval never crosses an ocean.
Observability
Logs, traces and per-city p99 are on by default and kept 30 days on Pro. OpenTelemetry out, no agents to install.
[04] / ARCHITECTURE
Every request walks the same stack, bottom to top. Scroll to take it apart.
L1 . Network
One IP, announced over BGP from every city. TLS terminates in the city nearest the user, and traffic between regions rides our private backbone instead of the public internet.
312 PoPs . 2.1 Tbps . 9 ms median to the nearest city
L2 . Runtime
Every request gets a fresh V8 or WASM isolate. Thousands share a process, none share memory, and code that is not running costs nothing.
TS . JS . Python . Rust . anything to WASM
L3 . Inference
The scheduler places each model where its traffic is, keeps warm replicas only where they pay for themselves, and streams tokens back over the same connection.
L4 . H100 . 180 ms first token p50
L4 . Data
Writes land in the nearest region and replicate in under 40 ms at p50. Reads come from the city that served the request, with read-your-writes for the same user.
KV . queues . vector index . cron
[05] / NETWORK
Each arc is a request finding its nearest city. Diamonds are GPU regions. Latencies are illustrative demo data.
live 1,284,019 req/s
global p50 23 ms
| city | share | p50 | p99, 60 s | gpu |
|---|---|---|---|---|
| fra1 Frankfurt | 9.4% | 11 ms | 41 | H100 |
| iad1 Washington | 8.8% | 9 ms | 38 | H100 |
| sin1 Singapore | 6.1% | 14 ms | 52 | L4 |
| gru1 São Paulo | 4.7% | 17 ms | 58 | L4 |
| hnd1 Tokyo | 4.2% | 8 ms | 33 | H100 |
| bom1 Mumbai | 3.6% | 16 ms | 55 | L4 |
[06] / DEVELOPERS
Declare where it runs and which model it needs. Kernel handles placement, GPUs, retries and streaming. The same handler runs locally with kernel dev.
import { kernel } from "@kernel/run";
export default kernel.fn({
region: "auto", // run next to each user
model: "llama-3.1-8b-q4", // nearest GPU region
}, async (req, { ai, kv }) => {
const { prompt } = await req.json();
const hit = await kv.get(`answer:${prompt}`);
if (hit) return Response.json(hit);
const stream = await ai.generate({ prompt, maxTokens: 400, stream: true });
return new Response(stream, {
headers: { "content-type": "text/event-stream" },
});
});from kernel import fn, Request
@fn(region="auto", model="llama-3.1-8b-q4")
async def handler(req: Request, ai, kv):
prompt = (await req.json())["prompt"]
# served from the city that took the request
if hit := await kv.get(f"answer:{prompt}"):
return hit
return ai.generate(prompt=prompt, max_tokens=400, stream=True)use kernel::{handler, Ctx, Request, Response};
#[handler(region = "auto", model = "llama-3.1-8b-q4")]
async fn ask(req: Request, ctx: Ctx) -> Result<Response> {
let prompt = req.json::<Ask>().await?.prompt;
if let Some(hit) = ctx.kv.get(&format!("answer:{prompt}")).await? {
return Ok(Response::json(hit));
}
ctx.ai.generate(&prompt).max_tokens(400).stream().await
}curl https://acme-api.kernel.run/ask \
-H "authorization: Bearer $KERNEL_TOKEN" \
-d '{"prompt": "Summarize ticket #4182"}'
# x-kernel-city: fra1
# x-kernel-gpu: fra-g2
# x-kernel-ttfb: 21ms
# x-kernel-cold: false[07] / IN PRODUCTION
kernel, sin1 gpu ##### 62 ms one region, us-east ################################## 410 ms own cluster, eu-west ############################# 355 ms
Case study
Lattice Health
p95 first token, Southeast Asia
We moved our inference gateway on a Thursday. By Monday p95 in Southeast Asia was down from 410 to 62 ms, and the GPU bill dropped because quiet regions now scale to zero.
Priya Raman
Head of Platform, Lattice Health
Deploys are boring in the best way. We ship about 9,000 previews a week and nobody has filed a platform ticket since March.
Tomás IbarraPer-millisecond billing made the edge cheaper than our regional cluster. We deleted 14 Terraform modules and one on-call rotation.
Hannah Oduya[08] / PRICING
$0forever
Side projects and prototypes.
Most teams
$20per member / month
Production apps with real traffic.
Customannual
Regulated data, reserved GPUs.
KERNEL . PRO . MONTHLY ESTIMATE ------------------------------------ requests 120.0M ......... $33.00 cpu-ms 600.0M ......... $11.00 gpu-s 40.0k ......... $24.00 seats 3 ......... $60.00 ------------------------------------ est. monthly $128.00
Estimate only. Egress inside the Kernel network is free.
[09] / CHANGELOG
We ship every week. These are the ones you asked for most.
v4.12 . inference
gru1 and jnb1 now serve L4 and H100 capacity. Median first token for users in South America dropped from 390 to 120 ms in the beta.
v4.11 . runtime
Opt in with stream: "wt". Streams survive network switches on mobile without restarting the generation.
v4.10 . cli
kernel logs --tailFilter live logs by city, status, model or any JSON field: --where 'status>=500 and city=fra1'.
v4.9 . placement
Functions that make many calls to one database now run next to it automatically. A typical checkout flow went from 9 round trips across the Atlantic to zero.
v4.8 . data
A user who writes in Frankfurt and reads from Singapore a second later sees their own write, without making every read strongly consistent.
[10] / FAQ
Most serverless platforms run containers in a few regions and keep them warm. Kernel runs isolates in every one of 312 cities, so there is no region to choose and a cold start costs 4.2 ms instead of seconds. Inference runs on the same network, so your function and your model are one hop apart.
TypeScript and JavaScript with most Node APIs, Python 3.13, Rust, and anything that compiles to WASM. Each has a typed SDK and the same local dev server.
Yes. Pin a project to the EU or US jurisdiction and its KV, queues, vectors, logs and GPU work never leave it. Requests from elsewhere still terminate TLS at the nearest city and are forwarded over our backbone. Kernel is SOC 2 Type II audited, and every plan encrypts data at rest and in transit.
Bring your own weights as safetensors, GGUF or ONNX up to 140B parameters, or pick from 140 open models we keep warm. Fine-tunes ship as LoRA diffs. There is also an OpenAI-compatible endpoint so existing clients work unchanged.
You pay per request, per CPU millisecond and per GPU second, with no charge for idle time or for traffic inside our network. Every plan has hard spend limits: when you hit one, we stop serving and email you rather than bill you.
Anycast withdraws the route and traffic moves to the next nearest city in under two seconds. Models with warm replicas fail over the same way; others cold-start in the next GPU region.
Free to start, no card. When you are ready for reserved GPUs or EU-only data, an engineer, not a sales script, will call you back.