Skip to content

Compatibility ​

What runs where, what converts in which direction, and what is missing, all tested under python/ and tests/.

Backends ​

TargetCallNotes
PyTorchlinnet.torch.loadinterpreted, or generated source (compile=True); trainable=True for autograd
JAXlinnet.jax.load, load_source, load_nnxXLA (no VJP), differentiable generated jnp code, or either as Flax NNX
StableHLOlinnet stablehlo --bind ...static shapes
ONNXlinnet onnx --bind ...opset 20 text format
ONNX, packagedlinnet.onnx.export_modelcheckpoint embedded; runs in any ONNX runtime
vLLM, SGLang, TGI, transformerslinnet.hf.exportllama, qwen2, qwen3, phi3, and gpt2 families
llama.cpp, Ollamalinnet.gguf.exportthe same families
Triton Inference Serverlinnet.triton.exportpackaged ONNX, or a Python backend for stateful entries
ComfyUIlinnet-comfyuinode pack

Importers ​

SourceCallRecovers
PyTorch moduleslinnet.torch.export_linnetmodule tree as blocks; common layers as library calls; matmul and einsum as index notation
JAX functionslinnet.jax.export_linnetparameter pytree as blocks; softmax, sigmoid, silu, gelu, and RMS norm
StableHLO textlinnet.jax.import_stablehlothe same, for modules from elsewhere
ONNX modelslinnet.onnx.import_onnxinitializer names as the hierarchy, dim_params as generics, the common operators, PyTorch's RMS norm, SiLU, and softmax

Importers never guess: an unmapped operation stops the import by name.

Real checkpoints ​

The Llama and GPT-2 examples with TinyLlama-1.1B's and GPT-2's weights match transformers logits within 2e-2 in f32, with identical argmax, through KV-cache decoding. LINNET_HF_TESTS=1 runs python/linnet/tests/torch/test_hf_checkpoints.py.

Language features by backend ​

FeaturePyTorchJAX and StableHLOONNX
Symbolic shapesbound at load and from inputsbound per compilebound per export
static foryesunrolledunrolled
whileyes, also in generated sourcestablehlo.while, lax.while_loopLoop
Index notation and reductionsyesyesyes
Optional parametersyes--optionalsyes
Enum constants and matchyesfoldedfolded
Tuple resultsyesyesone output per element
state membersbuffers, reset_state()threaded in and outthreaded in and out
std.randomyesyesyes (right shifts are logical)
Traininglinnet.train: SFT, DPO, GRPO, LoRA, FSDP; transformers' Trainer and TRLlinnet.jax.train: SFT, DPO, GRPO, LoRA, FSDP over a mesh, remat; load_source with jax.gradno
dtypesf16, bf16, f32, f64, i8 to i64, u8, boolas the backend supportsas opset 20 supports

Not yet ​

  • A scan that collects per-iteration outputs; data-dependent shapes.
  • Importers: erf-based GELU, softmax over an axis other than the last, general gather and scatter, custom calls.
  • Activation quantization. Weights can be int8, int4, group-wise 4-bit (GPTQ, AWQ), or MXFP4.

Released under the MIT License.