Models / all-MiniLM-L6-v2

all-MiniLM-L6-v2

The most downloaded model on the Hub: a 6-layer, width-384 BERT encoder distilled for sentence embeddings, mean-pooled and L2-normalized.

22.6M parametersbertApache-2.0sentence-similaritytext-encoderencoder-onlyfeature-extraction

NVIDIA H100 80GB HBM3 · median of 10 runs after 3 warm-ups · measured 2026-09-28T17:57:04+00:00

Linnet 0.1.0, PyTorch 2.14.0, JAX 0.11.2, transformers 5.17.0, diffusers 0.40.0, ONNX Runtime 1.30.0, Python 3.12.3, driver 580.126.09

Linnet against the stack it replaces

Each side in its fastest configuration, on the same GPU and checkpoint. A speed-up is how many times the other's speed; an export is measured against the original checkpoint in the same engine.

vs the reference, in PyTorch2.61× fasterlatency
  • Linnet, CUDA graphs0.32 mstransformers, compiled0.84 ms
vs KerasHub, in JAX8.91× fasterlatency
  • Linnet, XLA (generated JAX)0.44 msKerasHub3.96 ms
vs torch.onnx, on ONNX Runtime0.84× slowerlatency
  • Linnet, ONNX Runtime f321.21 mstorch.onnx export1.02 ms
vs torch.onnx, behind Triton1.00× slowerlatency
  • Triton, Linnet's ONNX2.15 msTriton, torch.onnx export2.15 ms

Each row also carries its distance from reference: the largest absolute difference between its output and transformers (eager)'s on the same input. bf16 outputs differ by rounding (about 0.1 on logits near 16), so a small number is expected; it is there so that a fast wrong answer cannot look like a win.

Latency

ms, lower is better; the best bar is red.

PyTorchJAXONNX Runtime and TensorRTTriton Inference Server01234mstransformers1.91 mstransformers, compiled0.84 mssentence-transformers3.21 msLinnet, generated PyTorch1.03 msLinnet, inductor0.79 msLinnet, CUDA graphs0.32 msKerasHub3.96 msLinnet, XLA (StableHLO)0.52 msLinnet, XLA (generated JAX)0.44 mstorch.onnx export1.02 msLinnet, ONNX Runtime f321.21 msLinnet, ONNX Runtime f161.05 msLinnet, ONNX Runtime bf161.05 msLinnet, TensorRT f320.35 msLinnet, TensorRT f160.23 msLinnet, TensorRT bf160.24 msTriton, torch.onnx export2.15 msTriton, Linnet's ONNX2.15 msTriton, Linnet Python backend1.39 ms

Throughput

/s, higher is better; the best bar is red.

PyTorchJAXONNX Runtime and TensorRTTriton Inference Server0250005000075000/stransformers26,734/stransformers, compiled50,395/ssentence-transformers6,431/sLinnet, generated PyTorch49,772/sLinnet, inductor70,709/sLinnet, CUDA graphs74,093/sKerasHub11,661/sLinnet, XLA (StableHLO)38,961/sLinnet, XLA (generated JAX)39,720/storch.onnx export19,156/sLinnet, ONNX Runtime f3220,250/sLinnet, ONNX Runtime f1634,378/sLinnet, ONNX Runtime bf1634,780/sLinnet, TensorRT f3234,138/sLinnet, TensorRT f1680,632/sLinnet, TensorRT bf1674,959/sTriton, torch.onnx export1,107/sTriton, Linnet's ONNX1,111/sTriton, Linnet Python backend1,100/s

Load time

s, lower is better; the best bar is red.

PyTorchJAXONNX Runtime and TensorRTTriton Inference Server0510stransformers2.19 stransformers, compiled1.49 ssentence-transformers2.44 sLinnet, generated PyTorch0.62 sLinnet, inductor0.63 sLinnet, CUDA graphs0.57 sKerasHub6.72 sLinnet, XLA (StableHLO)0.33 sLinnet, XLA (generated JAX)0.29 storch.onnx export12.4 sLinnet, ONNX Runtime f320.29 sLinnet, ONNX Runtime f160.29 sLinnet, ONNX Runtime bf160.28 sLinnet, TensorRT f320.28 sLinnet, TensorRT f160.28 sLinnet, TensorRT bf160.27 sTriton, torch.onnx export6.18 sTriton, Linnet's ONNX10.0 sTriton, Linnet Python backend6.03 s

Peak GPU memory

What the driver reports the process holding at its peak, in GiB; lower is better; the best bar is red.

PyTorchJAXONNX Runtime and TensorRTTriton Inference Server012GiBtransformers0.86 GiBtransformers, compiled0.87 GiBsentence-transformers0.80 GiBLinnet, generated PyTorch0.84 GiBLinnet, inductor0.82 GiBLinnet, CUDA graphs0.95 GiBKerasHub0.25 GiBLinnet, XLA (StableHLO)0.34 GiBLinnet, XLA (generated JAX)0.31 GiBtorch.onnx export1.45 GiBLinnet, ONNX Runtime f321.46 GiBLinnet, ONNX Runtime f161.11 GiBLinnet, ONNX Runtime bf161.11 GiBLinnet, TensorRT f322.50 GiBLinnet, TensorRT f162.41 GiBLinnet, TensorRT bf162.41 GiBTriton, torch.onnx export1.52 GiBTriton, Linnet's ONNX1.55 GiBTriton, Linnet Python backend2.38 GiB

Every number

MethodLatencyThroughputLoad timePeak GPU memoryAgainst the stack it replacesDistance from referenceNotes
PyTorch
transformers1.91 ms26,734/s2.19 s0.86 GiB0 (the reference)unpadded batches of exactly 128 tokens (this card takes no padding mask)
transformers, compiled0.84 ms50,395/s1.49 s0.87 GiB0.0469unpadded batches of exactly 128 tokens (this card takes no padding mask)
sentence-transformers3.21 ms6,431/s2.44 s0.80 GiBnot comparednatural text tokenizing to 65 tokens, identical across the batch (no padding wasted); not the fixed-length random-token workload the other rows use, since this is the library's own string-in interface
Linnet, generated PyTorch1.03 ms49,772/s0.62 s0.84 GiB0.82× transformers, compiled0.0625unpadded batches of exactly 128 tokens; bf16 on cuda
Linnet, inductor0.79 ms70,709/s0.63 s0.82 GiB1.07× transformers, compiled0.0625unpadded batches of exactly 128 tokens; bf16 on cuda
Linnet, CUDA graphs0.32 ms74,093/s0.57 s0.95 GiB2.61× transformers, compiled0.0625unpadded batches of exactly 128 tokens; bf16 on cuda
JAX
KerasHub3.96 ms11,661/s6.72 s0.25 GiB0.0469bf16, under jax.jit; unpadded batches of exactly 128 tokens; peak memory is JAX's allocator peak; the driver shows its pool, which grows in whole regions
Linnet, XLA (StableHLO)0.52 ms38,961/s0.33 s0.34 GiB7.58× KerasHub0.0469unpadded batches of exactly 128 tokens; bf16 on cuda; peak memory is JAX's allocator peak; the driver shows its pool, which grows in whole regions
Linnet, XLA (generated JAX)0.44 ms39,720/s0.29 s0.31 GiB8.91× KerasHub0.0469unpadded batches of exactly 128 tokens; bf16 on cuda; peak memory is JAX's allocator peak; the driver shows its pool, which grows in whole regions
ONNX Runtime and TensorRT
torch.onnx export1.02 ms19,156/s12.4 s1.45 GiB0.0629the reference model's own ONNX export, f32 like Linnet's; unpadded batches of exactly 128 tokens
Linnet, ONNX Runtime f321.21 ms20,250/s0.29 s1.46 GiB0.84× torch.onnx export0.0629f32; ONNX Runtime's CUDA execution provider; first calls build the sessions; unpadded batches of exactly the sequence length
Linnet, ONNX Runtime f161.05 ms34,378/s0.29 s1.11 GiB0.0645f16; ONNX Runtime's CUDA execution provider; first calls build the sessions; unpadded batches of exactly the sequence length
Linnet, ONNX Runtime bf161.05 ms34,780/s0.28 s1.11 GiB0.0352bf16; ONNX Runtime's CUDA execution provider; first calls build the sessions; unpadded batches of exactly the sequence length
Linnet, TensorRT f320.35 ms34,138/s0.28 s2.50 GiB0.0638f32; ONNX Runtime's TensorRT execution provider; first calls build the sessions; unpadded batches of exactly the sequence length
Linnet, TensorRT f160.23 ms80,632/s0.28 s2.41 GiB0.0586f16; ONNX Runtime's TensorRT execution provider; first calls build the sessions; unpadded batches of exactly the sequence length
Linnet, TensorRT bf160.24 ms74,959/s0.27 s2.41 GiB0.0469bf16; ONNX Runtime's TensorRT execution provider; first calls build the sessions; unpadded batches of exactly the sequence length
Triton Inference Server
Triton, torch.onnx export2.15 ms1,107/s6.18 s1.52 GiB0.0629over HTTP; f32; throughput with 4 requests of batch 64 in flight
Triton, Linnet's ONNX2.15 ms1,111/s10.0 s1.55 GiB1.00× Triton, torch.onnx export0.0629over HTTP; f32; throughput with 4 requests of batch 64 in flight
Triton, Linnet Python backend1.39 ms1,100/s6.03 s2.38 GiB0.0625over HTTP; bf16, CUDA graphs; throughput with 4 requests of batch 64 in flight