Fast Embeddings on GPUs

Perplexity embeds a 128-token query in 1.53 ms where vLLM takes 4.60 ms, on the same H200 and the same model. The GPU work is about the same. The win is on the host.

Pick a query length, then press Send. Watch the same request race through both engines. Then we take the host side apart, piece by piece: the arithmetic, the launches, the graphs, the overlap and the gateway.

You need what a vector embedding is and what one transformer forward pass does. We build the rest from zero.

Based on Perplexity Engineering, Fast Embeddings on GPUs (4 September 2026). Benchmark numbers come from the post's charts. GPU specs come from NVIDIA's H200 page, read on 22 November 2026. Part of the Embedding family, with Vector Embeddings and Embedding Ops.

Race one query through two engines

Totals are the post's median (p50) latencies for BGE-M3 at batch size one. The split is ours. Teal is the token work from a three-point fit to Tulip's numbers (Chapter 3), drawn the same for both engines. Warm is the rest. We slow time about 400 times.

Chapter 0

Search Runs on Embeddings

Find where three times of speed can hide when the GPU side is already solved

You type a question into a search box. Before an answer comes back, a small neural network turns your sentence into a list of numbers, an embedding. A vector database then finds the documents whose embeddings sit closest to yours. Vector Embeddings builds that idea from zero.

On 4 September 2026, Perplexity Engineering published a tour of the servers that make those embeddings. It opens with a concession: the GPU side "has converged to a largely optimal implementation across various inference engines." Then it reports a median request three times faster than vLLM v0.22.0, on the same model, precision and GPU.

Same GPU work, three times faster. The gap lives on the host: the CPU that parses the request, tokenizes it, schedules it, launches GPU programs and copies the answer back.

Three traffic patterns

PatternWho waitsGoalBenchmark shape
Batch embeddingNobody: an index rebuildThroughput, so low cost100 sequences per request, 4 senders
ScoringA person, for a batchA balance of both5, 25 or 50 sequences
Online embeddingA person, for one queryLow latency1 sequence, one at a time

Compare the engines per pattern

Blue is Perplexity's server, purple is vLLM. Pick a pattern and read the ratio.

Published BGE-M3 numbers from the post's charts. Batch: 512 tokens, embeddings per second. Scoring (batch 5) and online (128 tokens): p50 milliseconds.

The win is 1.12 times for bulk work and 3.0 times for one short query. A fixed host cost is a big share of a small request and a tiny share of a big one.

The failure this lesson cures. Symptom: the embedding call is wide in a trace while GPU utilisation reads under 10 percent. Measure: compare the device time of one forward pass with the request's wall clock. Fix: cut host cost; a bigger GPU changes nothing.

The road

  1. Prefill and decode: arithmetic intensity says when the GPU waits on memory.
  2. The three services: Ivy, Tulip and ROSE, and why two languages.
  3. Tokens, not sequences: the cost model behind a simple scheduler.
  4. Launch overhead: the host cost that dwarfs a small forward pass.
  5. CUDA graphs: one call for the whole pass, captured lazily.
  6. LazyTensor and overlap: prepare the next batch while this one runs.
  7. One engine: ragged attention, no KV cache.
  8. Ivy: chunk large requests and balance replicas.
  9. The kernels: where a few percent still hides.
  10. The benchmarks: the cells the post wins, ties and loses.
  11. Field guide: numbers, checklist, code and sources.
Why does the online pattern gain 3.0 times while bulk indexing gains only 1.12 times?

Chapter 1

Embeddings Are Prefill and Decode

Count FLOPs and bytes to see why an LLM engine's kernels already fit embedding work

Perplexity serves embeddings with its LLM kernels. Bulk embedding is "similar to compute-bound prefill"; a short query is "computationally similar to memory-bound decode." Prefill is an LLM reading a whole prompt at once, so many tokens share each read of a weight. Decode writes one token per step, so each weight read serves one token.

Take one dense layer: a weight matrix of d by d numbers, applied to T token vectors, in BF16 (2 bytes a number). Each output number is d multiplies and d adds, so the work is 2Td² FLOPs (floating point operations). The bytes are the weights, 2d², plus each token vector read and written, 4Td. Arithmetic intensity is FLOPs per byte moved; call it I.

Say it aloud

I equals two T d squared, over two d squared plus four T d.

I
I arithmetic intensity: FLOPs per byte moved.
2Td²
two T d squared the FLOPs: one multiply and one add per weight per token. T is the token count, d the model width.
2d²
two d squared bytes of weights, read once.
4Td
four T d bytes of token vectors, read in and written out.
In plain words

Count the FLOPs: two per weight per token. Count the bytes: the weights once, plus every token vector in and out. Divide the first by the second.

With numbers

BGE-M3 has width d = 1024. One query token, T = 1: 2,097,152 FLOPs over 2,101,248 bytes, so I = 1.0. A batch of T = 512: 1,073,741,824 FLOPs over 4,194,304 bytes, so I = 256.

A GPU has a machine balance, B: the FLOPs it can do in the time it fetches one byte. The H200 SXM does 989.5 TFLOPS of dense BF16 (NVIDIA lists 1,979 with sparsity) over 4.8 TB/s of memory bandwidth. So B = 206. Below B, the layer waits on memory. Above B, it waits on arithmetic.

Say it aloud

T-star equals B times d, over d minus two B.

T*
T-star the crossover token count, where I equals B.
B
B machine balance: 206 FLOP per byte on an H200.
d
d model width: 1024 for BGE-M3.
In plain words

Set I equal to B and solve for T. A batch with fewer than T-star tokens is memory-bound. More is compute-bound.

With numbers

T* = 206 × 1024 / (1024 − 412) = 210,944 / 612 = 345 tokens. The post puts GPU saturation for a sub-billion model at about 512 tokens, the same order.

Walk a batch along the roofline

The slope is the memory roof, the flat line the arithmetic roof. Drag the token count and watch the dot cross the knee.

8
1024

One dense layer in BF16 on H200 datasheet peaks (989.5 TFLOPS dense, 4.8 TB/s). Real kernels reach less than the roof.

The failure: symptom, buying faster compute does not raise tokens per second. Measure: compute I for your typical batch. Fix: if I is far below B, batch more tokens or stop chasing FLOPs.

Why can an LLM engine reuse its prefill and decode kernels for embeddings?

Chapter 2

Tulips, Roses, and Some Ivy

Follow one request through three services and see what crosses each wire

The post's diagram starts with one HTTP request: {"model": "pplx-embed", "input": ["Roses are red", "The quick brown fox"]}. At the GPU, the two strings are token ids, [3630, 288, 525, 2518] and [17823, 574, 1382, 38835], on two different replicas.

ServiceBuilt inIts jobPasses on
IvyRust, HTTP gatewayJSON parsing, tokenization, input templates, batch splitting, load balancingToken ids over a custom gRPC protocol
TulipRust, tokio, tonicRequest pool, scheduling, batching, returning resultsBatches to ROSE's step()
ROSEPythonKernels, layers, forward passes, CUDA graph managementA LazyTensor: a handle to running GPU work

Step a request through the stack

Press Next hop. The packet moves one service on, and the read-out says what it carries.

Request and token ids are the ones in the post's architecture diagram. Box sizes are not to scale.

Why a separate gateway. Tokenizer settings and templates change often; weights and captured graphs do not. The post's reason: Ivy lets them change these "without having to touch the heavier inference instances." A template edit becomes a config rollout, not a restart that throws away every captured graph.

Why Rust for Tulip. Tokio is Rust's asynchronous runtime: one process holds thousands of waiting requests without a thread each. Tonic is the gRPC library on top. Waking a task and copying a buffer sit on the critical path, so they run without Python's interpreter lock.

Why Python for ROSE. New models get written there fast. The bridge is one function, step(batch), which "takes a batch and returns a reference to the computation it performs on the accelerator." Chapter 6 builds that reference.

The failure: symptom, p99 spikes for minutes after every template change. Measure: plot p99 against deploy times. Fix: move tokenization and templates out of the model server into a stateless gateway.

Which service tokenizes, and what does the next service receive?

Chapter 3

Latency Is Tokens, Not Sequences

Derive why a first-come, first-served scheduler is enough, then fit the model to published numbers

Tulip's scheduler is simple: requests pile up while the engine works, then sequences leave "on a first-come, first-served basis." No sorting by length. Why is that safe? Count the work in one transformer block for a sequence of L tokens.

The dense work is the four attention projections, 4 × 2Ld², plus a feed-forward layer of width 4d, 2 × 2Ld × 4d. That is 24Ld². The attention work is the score matrix, 2L²d, plus mixing the values, 2L²d: 4L²d.

Say it aloud

Four L squared d, over twenty-four L d squared, equals L over six d.

4L²d
four L squared d attention FLOPs: they grow with the square of the length.
24Ld²
twenty-four L d squared dense FLOPs: they grow in a straight line with the length.
L
L tokens in the sequence.
d
d model width: 1024 for BGE-M3.
In plain words

Divide attention work by dense work. Most factors cancel. Attention catches up with dense work only when L reaches six times d.

With numbers

d = 1024, L = 512: 512 / 6,144 = 0.083. Attention is 8 percent of the dense work. The two are equal at L = 6,144.

So time follows the total token count. Two sequences of 256 cost about what one of 512 costs. Check it on the post's numbers: Tulip's median for BGE-M3 at batch one is 1.53, 2.03 and 9.57 ms at 128, 512 and 4,096 tokens. Call the fixed cost c, the cost per token a, and the attention cost per squared token b.

Say it aloud

t of L equals c, plus a times L, plus b times L squared.

t(L)
t of L median request time, in ms, for L tokens.
c
c the fixed cost: the hop, the queue, launches, the copy back.
a
a ms per token: the dense work.
b
b ms per token squared: the attention work.
In plain words

Write the equation once for each of the three measurements. Solve the three equations for c, a and b.

With numbers

c = 1.377 ms, a = 0.001173 ms per token, b = 0.000000202. At L = 512: aL = 0.600 ms and bL² = 0.053 ms, so attention is 8.1 percent of the token work. The hand count said 8 percent.

Cut the same tokens many ways

Warm is c, teal is dense work, the light teal tail is attention. Change how many sequences share the tokens. Then change the tokens.

2048
1

The fitted model above, applied to equal-length sequences. It fits three published points exactly, so treat values far from them as estimates.

Cut 2,048 tokens into 1 or 32 sequences: 4.63 ms against 3.81 ms. The token count sets the price. And c is 1.38 of the 1.53 ms request: 90 percent of it does not depend on tokens at all. Chapters 4 to 8 shrink c.

pythonfrom collections import deque
pool = deque()                                   # (request_id, length) in arrival order
def next_batch(budget=512, max_seqs=64):
    batch, used = [], 0
    while pool and len(batch) < max_seqs:
        rid, L = pool[0]
        if batch and used + L > budget: break     # waits for the next batch
        batch.append(pool.popleft()); used += L
    return batch, used                            # no sorting: tokens are the price

The failure: symptom, a short query waits behind a tightly packed batch of long ones. Measure: p99 of short requests under mixed load. Fix: first come, first served; packing saves nothing when the batch has no padding.

A batch holds 512 tokens. You add four sequences of 128 tokens. What does the model predict?

Chapter 4

Launch Overhead: CPU Versus GPU

Find the token count below which the GPU waits for Python

A kernel is one GPU program: a matrix multiply, a norm, an add. For each kernel, the host runs Python dispatch, works out shapes, allocates the output and calls the CUDA driver. That costs a few microseconds, whether the kernel then runs for 2 microseconds or 2 milliseconds.

The post's diagram shows six host calls in a row (rms_norm, linear, sdpa, rms_norm, linear, add). Under them sit the six kernels, with hatched blocks labelled GPU IDLE between them. The GPU finished and waits for the next launch.

Call the kernels in one forward pass N, the host time per launch ℓ, and the device time per token τ. The host time is fixed. The device time grows with tokens. Where they meet is the inflection point.

Say it aloud

T-inf equals N times ell, over tau.

Tinf
T-inf the inflection point: tokens at which device time equals host launch time.
N
N kernels per forward pass.
ℓ
ell host time to launch one kernel, in microseconds.
τ
tau device time per token for the whole pass, in microseconds.
In plain words

Multiply the kernel count N by the launch cost ell to get the host bill. Divide by tau. Below that many tokens, the GPU idles.

With numbers

With made-up numbers: 24 layers of 6 kernels, N = 144, and ell = 5 µs, so the host needs 720 µs. With tau = 0.72 µs per token, Tinf = 720 / 0.72 = 1,000 tokens.

BatchDevice timeHost launchesGPU idle
128 tokens92 µs720 µs87%
512 tokens369 µs720 µs49%
1,000 tokens720 µs720 µs0%: the inflection

The post measures this per model and finds the point "comes at batches of thousands of tokens and tens of sequences." Our toy says 1,000.

Watch the GPU wait for the host

Warm boxes are launches, teal boxes are kernels, hatches are idle GPU. Raise the tokens, then switch to one graph replay.

128
5 µs

Illustrative: 144 kernels with device time shared evenly, 0.72 µs per token, and 8 µs for one graph replay. The drawing shows the first 12 kernels; the read-out counts all 144.

One kernel can block the fix of Chapter 5. The post: some attention kernels "rely on dynamic host-side inputs to configure kernel launches." Perplexity changed those kernels and sent the changes upstream.

The failure: symptom, GPU utilisation near 8 percent while p99 triples under load. Measure: a profiler trace shows short kernels with white gaps between them; N times ell beats device time. Fix: replace the launches with one graph replay.

A pass issues 144 kernels at 5 µs each. A 256-token batch needs 184 µs of device time. What limits it?

Chapter 5

CUDA Graphs, Captured Lazily

Replace 144 launches with one call, then pay for the capture while serving

A CUDA graph is a recording of every kernel launch in a forward pass, with its arguments. One driver call replays the whole pass. The post: this removes "the need to re-run expensive Python and PyTorch code." On replay there is no dispatch, no shape work and no allocation.

A graph has two hard rules. Shapes are frozen: 4 sequences of 512 tokens need a different graph from 8 sequences of 512. Addresses are frozen: the graph reads a fixed input buffer and writes a fixed output buffer. So you copy new data into the input buffer, replay, and read the output buffer.

pythonstatic_in = torch.zeros(T, D, device="cuda")       # fixed shape, fixed address
forward(static_in)                                    # eager warmup: kernels chosen, buffers made
g = torch.cuda.CUDAGraph()
with torch.cuda.graph(g):                             # capture: launches recorded, not run
    static_out = forward(static_in)
static_in.copy_(next_batch); g.replay()               # one driver call for the whole pass

One graph per configuration means one per pair of sequence count and token count. The post pads token counts up to a bucket, a multiple of 64 or 256. Call the real token count n and the bucket P.

Say it aloud

w equals P minus n, over P.

w
w padding waste: the share of the padded batch that is filler.
P
P the bucket: the smallest bucket size at or above n.
n
n real tokens in the batch.
In plain words

Round n up to the next bucket P. The rounded-up part, P minus n, is filler. Divide by P to get its share.

With numbers

n = 130 with 64-token steps: P = 192, w = 62 / 192 = 32 percent. n = 500: P = 512, w = 12 / 512 = 2.3 percent.

Trade padding against graph count

Teal is real tokens, yellow is padding. Pick a bucket step and drag the batch size.

130

Illustrative grid: one step size up to 8,192 tokens and 1 to 64 sequences, so the graph count is buckets times 64. The prose example mixes 64 and 256. The post says only "multiples of 64 or 256" and "thousands of graphs."

With 64-token steps to 1,024 and 256-token steps to 8,192, there are 44 buckets, so 44 × 64 = 2,816 graphs. At an illustrative 62 ms of warmup plus 41 ms of capture each, that is 4.8 minutes. The post: "thousands of graphs that might take multiple minutes."

So Perplexity captures lazily. Each configuration walks three states:

  1. First hit: run eagerly and serve. Kernels and buffers now exist.
  2. Second hit: capture the graph, then replay it.
  3. Every later hit: replay only. One driver call.

The cost, in the post's words: lazy capture "has an impact on p99 latencies during startup," but it spreads "multiple minutes of eager work across multiple hours." A replica joins the fleet in seconds.

The failure: symptom, scale-up lands minutes after the traffic spike. Measure: time from process start to first request served. Fix: capture lazily and accept a worse startup tail.

Why capture CUDA graphs lazily rather than all at startup?

Chapter 6

LazyTensor and Overlap

Return a handle instead of a value, so the host prepares the next batch while the GPU works

A kernel launch only queues work. To read the result, the host must wait. Three CUDA pieces make the wait cheap:

ROSE's LazyTensor holds three things. A pinned host buffer, a device-to-host copy (cudaMemcpyAsync) queued after the forward pass on the same stream, and an event after the copy. The stream runs in order. So the event fires only when the pass has finished and the bytes have landed. One event covers both.

pythonclass LazyTensor:
    def __init__(self, src):                          # src: [batch, dim] on the GPU
        self.host = torch.empty_like(src, device="cpu", pin_memory=True)
        self.host.copy_(src, non_blocking=True)         # queued behind the forward pass
        self.event = torch.cuda.Event(); self.event.record()
    def ready(self):  return self.event.query()      # never blocks
    def synchronize(self):                            # the only call that blocks
        self.event.synchronize(); return self.host

Now step() returns a LazyTensor and does not wait. The host builds the next batch while the GPU runs this one. Call the host time to prepare a batch p and the device time g. Call the time to collect a result k, and the number of batches N. A loop that waits on every step takes N(p + g + k).

Say it aloud

T-ov equals p, plus N times g, plus k.

Tov
T-ov wall time for N batches with overlap, when g is at least p plus k.
p
p host time to prepare and launch one batch.
N
N batches in a row.
g
g device time for one batch.
k
k host time to collect one result.
In plain words

The GPU runs the N batches back to back, N times g. The host work hides under that, except the first prepare p and the last collect k.

With numbers

With made-up numbers p = 3, g = 8, k = 1.5 ms and N = 6, waiting each step takes 6 × 12.5 = 75 ms. Overlap takes 3 + 48 + 1.5 = 52.5 ms, near the 48 ms floor.

Hide the host under the GPU

Top lane: GPU passes. Bottom lane: host prepare and collect. Switch to blocking and watch the idle gaps open.

3.0 ms
8 ms

Illustrative times, collect fixed at 1.5 ms, six batches, one stream. When p plus k exceeds g, the host becomes the floor.

The failure: symptom, the host thread sits inside a stream synchronize for a third of the run. Measure: search the request path for .item() and .cpu() calls. Fix: return a handle and synchronize once, when you need the value.

Where does the host block in the LazyTensor design, and why is one event enough?

Chapter 7

One Engine for LLMs and Embeddings

Find the three things that change when an LLM engine serves an embedding model

The post: "pplx-embed serving and Qwen3.5 LLM decoding all go through the same kernels." Dense layers need no change, because each token vector passes through them alone. Every weight sits in such a per-token layer. Only attention's score-and-mix step looks across tokens, so that is where the differences hide.

  1. No KV cache. An LLM keeps every key and value for later tokens. An embedding pass reads the sequence once and keeps nothing.
  2. Ragged inputs. Sequences sit end to end on one flat token axis, with no padding.
  3. Ragged kernels. ROSE dispatches attention variants that read the ragged layout.

Why ragged? Real traffic mixes a title, a paragraph and a page. A padded batch stretches every sequence to the longest one. Call the number of sequences n, the length of sequence i ℓi, and the longest length ℓmax.

Say it aloud

w equals one minus, the sum over i of ell-i, over n times ell-max.

w
w padding waste: the share of the padded rectangle that is filler.
Σi ℓi
the sum over i of ell-i all real tokens: add the length of every sequence.
n
n sequences in the batch.
ℓmax
ell-max the longest sequence: the rectangle's width.
In plain words

The rectangle holds n times ell-max cells. The real tokens fill the sum of the ell-i. One minus their ratio is the filler.

With numbers

With a made-up batch of 12 sequences from 39 to 484 tokens: the lengths sum to 3,677. The rectangle is 12 × 484 = 5,808. So w = 1 − 3,677 / 5,808 = 36.7 percent.

Pad it or lay it end to end

Top: the padded rectangle, yellow is filler. Bottom: the ragged strip with its offsets. Widen the length spread or deal a new batch.

70%

Random illustrative batches of 9 sequences up to 512 tokens. The offsets list is the cu_seqlens layout that ragged attention kernels read.

The ragged layout keeps one offsets array, by convention cu_seqlens. Sequence i lives in rows cu[i] to cu[i+1], and the kernel never looks outside them. The KV saving is a second win. A made-up LLM with 24 layers and 8 key-value heads of size 128, in BF16, would hold 361 MB for those 3,677 tokens. The embedding pass holds none.

The failure: symptom, a model wins in evaluation and regresses in production. Measure: check whether the research server pads batches and production does not. Fix: evaluate on the production engine, which this sharing allows.

What changes in attention when an LLM engine serves an embedding model?

Chapter 8

Ivy: Chunk, Balance, Tokenize

Split large requests on a token budget so no replica holds the whole job

One caller sends a 9-token query. Another sends 100 documents of 512 tokens. A third sends 8 documents of 4,096. Time follows tokens, so the work differs by four orders of magnitude. The post: "routing individual requests to individual replicas can cause load imbalance."

Round robin balances the count of requests. Requests are not what costs. A short request that lands behind a large one waits for all of it. That is head-of-line blocking, and it hits p99, not p50, because only the unlucky see it.

Ivy's fix: it "splits large-batch requests into chunks and load-balances them between replicas." Two details make it work. Chunks are cut on a token budget, because tokens are the price. Each chunk goes to the least loaded replica.

Balance four replicas

Bars are token load per replica; the dashed line is a perfect split. Switch the routing and change the chunk budget.

2048

Illustrative traffic: six requests, 136,064 tokens, on four replicas. The post gives the method, not a budget value.

Whole requests leave one replica with 83,968 tokens and another with 192. Chunks of at most 2,048 tokens bring the worst replica to 34,816, against a perfect 34,016. The slowest caller finishes 2.41 times sooner.

Chunk budgetBalanceOverheadGPU efficiency
Under 512 tokensVery goodMany messages and schedulesPoor: under saturation
1,000 to 4,000 tokensGoodSmallGood
No chunkingPoorNoneGood on one replica, others idle

Ivy also tokenizes, so the tokenizer is on the critical path of a 1.53 ms request. The post says its in-house unigram tokenizer "drastically improves latencies over off-the-shelf tokenizers."

The failure: symptom, p50 is healthy and p99 is four times worse under load. Measure: per-replica queue depth; one line stays high. Fix: chunk on tokens and route to the least loaded replica. More replicas do not cut size variance.

Why does chunking smooth latency even though it adds messages?

Chapter 9

But the Kernels Still Matter

Read a chart where two top attention kernels trade wins by a few percent

ROSE "integrated FlashInfer 2, FlashInfer 3 and FlashAttention 4 kernels to implement ragged attention." The post compares two of them across batch sizes and lengths. Its chart labels them FA4 and FA3. The text says FlashInfer 3 beats FlashAttention 4 on Qwen-based models at the longest lengths. The chart's FA3 wins sit there, so we read FA3 as FlashInfer 3.

ModelAttentionHead sizeFA3 wins
BGE-M3Multi-head: each query head has its own key and value head647 of 25 cells, at short lengths and large batches
pplx-embed-4bGrouped-query: several query heads share one key and value head1288 of 25 cells, every batch at 8,192

Find the winner per cell

Rows are batch size, columns are length. Blue cells are FA4 wins, green cells FA3. Tap a cell; switch models.

Every cell is the post's chart: winner, margin over the slower kernel, and throughput in thousands of tokens per second. The chart gives ties within 0.1 percent to FA4.

The largest margin anywhere is 3.37 percent. On pplx-embed-4b, 12 of 25 cells differ by less than half a percent. That is what "converged" looks like up close. The host-side fixes of Chapters 4 to 8 bought up to three times.

The post's rule: "we maintain support for multiple configurations and make a case-by-case decision when serving." Head count and head size change the tiles a kernel wants.

The failure: symptom, a team spends a quarter on kernel tuning and p50 moves 2 percent. Measure: share of request time spent inside attention kernels. Fix: fix host cost first; keep several backends only if your traffic sits in cells one of them wins.

Where does FA3 beat FA4, and how large are the margins?

Chapter 10

Benchmarks, Read Honestly

Look hardest at the cells where the faster engine does not win

The setup: vLLM v0.22.0 as the baseline, BF16, real weights, inputs from evaluation datasets, one H200. Before timing, warmup runs checked that the two engines' embeddings differ by under 0.1 percent in cosine similarity. That check stops a benchmark from winning by computing something else. Copy it first.

Explore every published cell

Blue is Tulip, purple is vLLM. Pick a benchmark and a model. A red ring marks a tie or a loss.

Medians (p50) from the post's charts, 10,000 requests each for latency. Embed: batch 1, sequential. Scoring: length 512. Throughput: batches of 100, four concurrent senders, embeddings per second.

The trend is one story. On BGE-M3 the median win is 3.0 times at 128 tokens, 2.3 at 512 and 1.22 at 4,096. On pplx-embed-1-0.6b at 4,096 tokens it is 1.05 times, and Tulip's p99 (16.32 ms) sits above vLLM's median (16.15 ms).

Throughput goes the same way. BGE-M3 gains 1.12, 1.11 and 1.08 times. On pplx-embed-1-0.6b, 1,024 tokens is a tie (422.8 against 423.3) and vLLM wins at 4,096 (73.5 against 72.2). A batch of 100 sequences of 4,096 tokens leaves no host cost to remove.

A tighter tail is a separate win. Scoring at batch 5 on pplx-embed-1-0.6b: vLLM's p99 is 24.24 ms against a median of 13.93. Tulip's p99 of 10.21 is 7 percent above its median of 9.51.

What the speedup is worth, at an illustrative $3 per GPU-hour: one million BGE-M3 embeddings of 512 tokens take 667 s on Tulip (1,499.3 a second), about $0.56, and 745 s on vLLM, about $0.62. Bulk work saves 10 percent. Short queries gain far more in latency.

The fourth chart adds Ivy's tokenization and the network hop, so it is the only end-to-end figure. It is a line chart without labels. At one request and 512 tokens, BGE-M3 reads about 3 ms for Tulip and about 12.5 ms for vLLM.

The failure: symptom, a team adopts a "3 times faster" engine and its bulk jobs speed up 3 percent. Measure: place your traffic on the length and batch grid. Fix: expect the win of your own cells, not the headline.

On pplx-embed-1-0.6b at 4,096 tokens, throughput is 72.2 for Tulip and 73.5 for vLLM. What follows?

Chapter 11

Owning the Stack

Keep the numbers, the diagnostic, the code and the sources in one place

The GPU side has converged, so the win moved to the host. Short requests are memory-bound and launch-bound. CUDA graphs cut the launches, lazy capture cuts startup, LazyTensor hides the host under the GPU, ragged batches cut padding, and Ivy cuts imbalance. The gains shrink to nothing where the GPU is the bottleneck.

TermMeaningThis lesson's number
Arithmetic intensity I2Td² / (2d² + 4Td)1.0 at T = 1; 256 at T = 512
H200 balance Bdense BF16 FLOPS / bandwidth989.5 T / 4.8 T = 206
Crossover T*Bd / (d − 2B)345 tokens
Attention shareL / (6d)8% at L = 512
Fixed cost cfit to Tulip p50s1.377 ms of 1.53
Inflection TinfNℓ / τ1,000 tokens (toy)
Bucket waste w(P − n) / P32% at n = 130
Overlap Tovp + Ng + k52.5 ms vs 75 (toy)
Ragged saving1 − Σℓi / (nℓmax)36.7% (toy)
Best published winBGE-M3, 128 tokens, p504.60 / 1.53 = 3.0×

The diagnostic, in order

The core, in code

pythonimport numpy as np
d, B = 1024, 989.5e12 / 4.8e12                         # BGE-M3 width; H200 balance, 206
I = lambda T: 2*T*d*d / (2*d*d + 4*T*d)               # Chapter 1
print(I(1), I(512), B*d / (d - 2*B))                   # 1.0  256.0  345

L = np.array([128., 512, 4096]); t = np.array([1.53, 2.03, 9.57])
c, a, b = np.linalg.solve(np.stack([np.ones(3), L, L**2], 1), t)
print(c, a, b)                                        # 1.377 ms, 0.001173, 2.02e-07 (Chapter 3)

N, ell, tau = 144, 5.0, 0.72                             # toy kernel count and costs (us)
print(N * ell / tau)                                  # 1000 tokens (Chapter 4)
pad = lambda n, step: -(-n // step) * step
print(1 - 130 / pad(130, 64))                             # 0.323 (Chapter 5)

Keep going

Sources

The habit. Before you tune a kernel, divide device time by wall time. If the GPU is idle most of the request, the work is on the host.

Now press Present or Teach. Explain from memory why a short query is memory-bound, where c comes from, and why one event covers both the pass and the copy. Then go back to the race, pick 4,096 tokens, and predict the gap before you press Send.

Fast Embeddings on GPUs
Read the post · Vector Embeddings · Back to Gleams