Models / modernbert-base

ModernBERT-base

Answer.AI's 2024 redesign of the BERT encoder: 22 pre-norm layers of width 768, rotary positions, GeGLU, no biases, and a sliding attention window that opens up every third layer.

149M parametersmodernbertApache-2.0fill-maskfeature-extractionencoder-onlyrotary-embeddingssliding-window-attention

NVIDIA H100 80GB HBM3 · median of 10 runs after 3 warm-ups · measured 2026-09-28T18:30:34+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.28× fasterlatency
  • Linnet, CUDA graphs1.01 mstransformers, compiled2.31 ms
vs torch.onnx, on ONNX Runtime0.99× slowerlatency
  • Linnet, ONNX Runtime f323.63 mstorch.onnx export3.59 ms
vs torch.onnx, behind Triton1.03× fasterlatency
  • Triton, Linnet's ONNX6.60 msTriton, torch.onnx export6.79 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 Server02.557.5mstransformers9.19 mstransformers, compiled2.31 msLinnet, generated PyTorch5.78 msLinnet, inductor2.15 msLinnet, CUDA graphs1.01 msLinnet, XLA (StableHLO)1.99 msLinnet, XLA (generated JAX)1.81 mstorch.onnx export3.59 msLinnet, ONNX Runtime f323.63 msLinnet, ONNX Runtime f162.79 msLinnet, ONNX Runtime bf163.24 msLinnet, TensorRT f321.71 msLinnet, TensorRT f161.25 msLinnet, TensorRT bf161.36 msTriton, torch.onnx export6.79 msTriton, Linnet's ONNX6.60 msTriton, Linnet Python backend3.97 ms

Throughput

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

PyTorchJAXONNX Runtime and TensorRTTriton Inference Server0200040006000/stransformers1,358/stransformers, compiled4,488/sLinnet, generated PyTorch2,780/sLinnet, inductor6,042/sLinnet, CUDA graphs6,153/sLinnet, XLA (StableHLO)3,252/sLinnet, XLA (generated JAX)3,506/storch.onnx export1,302/sLinnet, ONNX Runtime f321,347/sLinnet, ONNX Runtime f162,096/sLinnet, ONNX Runtime bf162,040/sLinnet, TensorRT f322,035/sLinnet, TensorRT f165,759/sLinnet, TensorRT bf165,456/sTriton, torch.onnx export267/sTriton, Linnet's ONNX263/sTriton, Linnet Python backend270/s

Load time

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

PyTorchJAXONNX Runtime and TensorRTTriton Inference Server0102030stransformers3.18 stransformers, compiled1.39 sLinnet, generated PyTorch1.39 sLinnet, inductor1.03 sLinnet, CUDA graphs1.36 sLinnet, XLA (StableHLO)0.58 sLinnet, XLA (generated JAX)0.63 storch.onnx export31.8 sLinnet, ONNX Runtime f320.29 sLinnet, ONNX Runtime f160.30 sLinnet, ONNX Runtime bf160.28 sLinnet, TensorRT f320.30 sLinnet, TensorRT f160.28 sLinnet, TensorRT bf160.28 sTriton, torch.onnx export12.0 sTriton, Linnet's ONNX18.1 sTriton, Linnet Python backend6.02 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 Server0246GiBtransformers1.88 GiBtransformers, compiled1.34 GiBLinnet, generated PyTorch1.27 GiBLinnet, inductor1.28 GiBLinnet, CUDA graphs1.41 GiBLinnet, XLA (StableHLO)0.91 GiBLinnet, XLA (generated JAX)1.21 GiBtorch.onnx export6.80 GiBLinnet, ONNX Runtime f324.71 GiBLinnet, ONNX Runtime f162.75 GiBLinnet, ONNX Runtime bf162.75 GiBLinnet, TensorRT f324.02 GiBLinnet, TensorRT f163.68 GiBLinnet, TensorRT bf163.68 GiBTriton, torch.onnx export6.94 GiBTriton, Linnet's ONNX6.90 GiBTriton, Linnet Python backend3.13 GiB

Every number

MethodLatencyThroughputLoad timePeak GPU memoryAgainst the stack it replacesDistance from referenceNotes
PyTorch
transformers9.19 ms1,358/s3.18 s1.88 GiB0 (the reference)unpadded batches of exactly 256 tokens (this card takes no padding mask)
transformers, compiled2.31 ms4,488/s1.39 s1.34 GiB2.13unpadded batches of exactly 256 tokens (this card takes no padding mask)
Linnet, generated PyTorch5.78 ms2,780/s1.39 s1.27 GiB0.40× transformers, compiled1.63unpadded batches of exactly 256 tokens; bf16 on cuda
Linnet, inductor2.15 ms6,042/s1.03 s1.28 GiB1.07× transformers, compiled1.25unpadded batches of exactly 256 tokens; bf16 on cuda
Linnet, CUDA graphs1.01 ms6,153/s1.36 s1.41 GiB2.28× transformers, compiled1.25unpadded batches of exactly 256 tokens; bf16 on cuda
JAX
Linnet, XLA (StableHLO)1.99 ms3,252/s0.58 s0.91 GiB1.47unpadded batches of exactly 256 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)1.81 ms3,506/s0.63 s1.21 GiB2.21unpadded batches of exactly 256 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 export3.59 ms1,302/s31.8 s6.80 GiB2.34the reference model's own ONNX export, f32 like Linnet's; unpadded batches of exactly 256 tokens
Linnet, ONNX Runtime f323.63 ms1,347/s0.29 s4.71 GiB0.99× torch.onnx export2.39f32; ONNX Runtime's CUDA execution provider; first calls build the sessions; unpadded batches of exactly the sequence length
Linnet, ONNX Runtime f162.79 ms2,096/s0.30 s2.75 GiB2.19f16; ONNX Runtime's CUDA execution provider; first calls build the sessions; unpadded batches of exactly the sequence length
Linnet, ONNX Runtime bf163.24 ms2,040/s0.28 s2.75 GiB2.25bf16; ONNX Runtime's CUDA execution provider; first calls build the sessions; unpadded batches of exactly the sequence length
Linnet, TensorRT f321.71 ms2,035/s0.30 s4.02 GiB2.35f32; ONNX Runtime's TensorRT execution provider; first calls build the sessions; unpadded batches of exactly the sequence length
Linnet, TensorRT f161.25 ms5,759/s0.28 s3.68 GiB2.16f16; ONNX Runtime's TensorRT execution provider; first calls build the sessions; unpadded batches of exactly the sequence length
Linnet, TensorRT bf161.36 ms5,456/s0.28 s3.68 GiB1.94bf16; ONNX Runtime's TensorRT execution provider; first calls build the sessions; unpadded batches of exactly the sequence length
Triton Inference Server
Triton, torch.onnx export6.79 ms267/s12.0 s6.94 GiB2.34over HTTP; f32; throughput with 4 requests of batch 64 in flight
Triton, Linnet's ONNX6.60 ms263/s18.1 s6.90 GiB1.03× Triton, torch.onnx export2.39over HTTP; f32; throughput with 4 requests of batch 64 in flight
Triton, Linnet Python backend3.97 ms270/s6.02 s3.13 GiB1.25over HTTP; bf16, CUDA graphs; throughput with 4 requests of batch 64 in flight