Skip to content

Examples ​

What Linnet is for, one example each. Nest has 24 checked models from MiniLM to gpt-oss 20B; these show the language and what runs on it.

ExampleWhat it shows
01-llamaThe language on a real decoder: grouped-query attention whose where clause states what its reshapes rely on, a KV cache in state, generation loops in the graph, and every layer as library source.
02-vitA vision model: patches cut by reshapes the checker proves, shapes sized by expressions, and pooling chosen by a compile-time enum.
03-clipA package of four modules: a dual encoder whose two towers share one encoder, with three entries over one parameter set.
04-serveLlama 3.1 8B served with continuous batching and CUDA graphs, faster than vLLM, and an OpenAI-compatible server.
05-train-vitA model trained from scratch in a plain PyTorch loop: a Linnet model is a torch.nn.Module.
06-loraLlama 3.1 8B fine-tuned with LoRA on one GPU, 1.8 times TRL's speed in less memory.
07-fsdpLlama 3.1 8B fine-tuned in full across four GPUs, in PyTorch and in JAX from the same card.
08-rlGRPO with the serving engine sampling, and DPO, on Llama 3.1 8B: 2.4 to 2.7 times TRL's speed.

The .linnet examples check with linnet lint --std stdlib examples/<name>, and the tests under python/linnet/tests/torch compare them with hand-written PyTorch. Weights bind by parameter path (linnet inspect --parameters); the tests fill them with random tensors through SafeTensors. The examples from 04-serve on run Nest's Llama 3.1 8B card on H100s, and their READMEs give the numbers measured there.

Sources ​

Each example's complete source, highlighted:

Released under the MIT License.