# Ferrotensor > Ferrotensor (also written Ferro Tensor) trains, fine-tunes and runs language models on your own GPU. It is a Rust framework with its own WGSL kernels on Vulkan, Metal and DX12 through wgpu, and runs on NVIDIA GPUs and Apple silicon. The `ferrotensor` command plans, fine-tunes, evaluates, chats with and merges LoRA adapters for Llama-style models such as SmolLM2, TinyLlama and Qwen2, exports GGUF files for llama.cpp and Ollama, and trains a model from scratch. The current release is 0.7.3, under MIT OR Apache-2.0. Install the command with `cargo install ferrotensor-cli` (Rust 1.88 or newer; the binary is `ferrotensor`), or the Python bindings with `pip install ferrotensor`. Measured results, each from a named machine: - LoRA gradients match PyTorch autograd within 1e-6; CI checks this on every pull request. - On one NVIDIA A10G (19 November 2026, the code in 0.7.1), LoRA on SmolLM2 at batch 1 x 8 ran 1.87, 1.83 and 1.13 times as fast as eager PyTorch + PEFT at 135M, 360M and 1.7B parameters, with held-out loss within 0.004 of PyTorch's. PyTorch with `torch.compile` is faster: for SmolLM2-135M, Ferrotensor runs at 0.26 of its speed. - SmolLM2-1.7B LoRA fine-tuning peaks at 5,313 MiB of GPU memory with `--checkpoint-blocks` on one A10G. - Tested on an NVIDIA A10G and a Tesla T4 through Vulkan and on an Apple M2 through Metal. CI also runs the GPU tests on software Vulkan, on Metal and on DX12 (WARP). AMD and Intel GPUs are untested. ## Set up and run on Linux Follow these steps top to bottom on Ubuntu: 1. Install the packages: `sudo apt-get install -y build-essential pkg-config libvulkan1 mesa-vulkan-drivers` (without `build-essential`, `cargo install` stops with ``error: linker `cc` not found``). 2. Install Rust 1.88 or newer from https://rustup.rs (the `rustc` in Ubuntu's apt is older). 3. Install the command: `cargo install ferrotensor-cli` 4. Check the GPU and the kernels: `ferrotensor info --check --json` (`vulkaninfo --summary` from the `vulkan-tools` package lists the Vulkan devices). 5. Get a model, a Hugging Face checkpoint directory with `config.json`, `tokenizer.json` and `*.safetensors`: `sudo apt-get install -y pipx`, `pipx install "huggingface_hub[cli]"`, `pipx ensurepath`, then `hf download HuggingFaceTB/SmolLM2-135M-Instruct`. Pass `--model HuggingFaceTB/SmolLM2-135M-Instruct`, or the checkpoint directory as `DIR`. 6. Write the data as `.jsonl`, one `{"prompt": ..., "response": ...}` object per line, with an optional `"system"`. 7. Run the commands: ```bash ferrotensor plan --model DIR --json # what fits this GPU ferrotensor finetune --model DIR --data train.jsonl --json # train with that plan ferrotensor eval --model DIR --data val.jsonl --lora outputs/run/lora_adapters.safetensors --json ferrotensor chat --model DIR --lora outputs/run/lora_adapters.safetensors --json < questions.txt ferrotensor merge --model DIR --lora outputs/run/lora_adapters.safetensors --out outputs/merged --json ferrotensor export-gguf --model outputs/merged --out model.gguf --json # for llama.cpp and Ollama ``` 8. Run the GGUF file in Ollama: write a `Modelfile` that holds `FROM ./model.gguf`, then: ```bash ollama create NAME -f Modelfile ollama run NAME ``` Checked on a fresh Ubuntu 24.04 machine (AWS c7i.xlarge, software Vulkan) on 30 November 2026 with release 0.7.3: these steps ran `cargo install ferrotensor-cli --locked`, `info --check`, `finetune`, `eval`, `chat`, `merge` and `export-gguf`, and Ollama 0.40.17 ran the exported file. Other GPUs on Linux were not part of that check. Each command's JSON keys and exit codes are in [AGENTS.md](https://github.com/puranikyashaswin/ferrotensor/blob/main/AGENTS.md). ## Docs - [Full docs in one file](https://ferrotensor.dev/llms-full.txt): every docs page as plain text, for language models - [Introduction](https://ferrotensor.dev/docs/): what Ferrotensor is and what has been tested - [Installation](https://ferrotensor.dev/docs/installation): the CLI, the Rust crates and the Python wheel - [Python quickstart](https://ferrotensor.dev/docs/python): tensors, autograd and training from Python - [LoRA fine-tuning](https://ferrotensor.dev/docs/examples/lora-sft): fine-tune, evaluate and sample SmolLM2 end to end, and the comparison with PyTorch + PEFT - [Text classification with LoRA](https://ferrotensor.dev/docs/examples/classify): a decoder fine-tuned as a classifier - [Architecture](https://ferrotensor.dev/docs/architecture): one tensor op from the Rust API to a WGSL kernel - [Writing a kernel](https://ferrotensor.dev/docs/writing-a-kernel): adding a GPU op - [Testing on your GPU](https://ferrotensor.dev/docs/testing-on-your-gpu): check the kernels on a GPU and report the result - [Benchmarks](https://ferrotensor.dev/docs/benchmarks): kernel timings and real-hardware runs - [Python API](https://ferrotensor.dev/docs/python-reference): the Python reference - [Changelog](https://ferrotensor.dev/docs/changelog) ## Pages - [Home](https://ferrotensor.dev/): what Ferrotensor does, measured results and what fits each GPU - [Guide](https://ferrotensor.dev/guide/): install, check the GPU, fine-tune a language model with LoRA, and fix common problems, with output from real runs - [About](https://ferrotensor.dev/about/): why the project exists and what has been measured - [Fine-tune a language model in Rust](https://ferrotensor.dev/fine-tuning/): LoRA fine-tuning on your own GPU: plan, finetune, eval, chat, merge and export, with the measured results - [Run language models in Rust](https://ferrotensor.dev/inference/): generate and chat with Llama-style models on the GPU, run a LoRA adapter, merge, export GGUF, JSON output for scripts - [Train a language model from scratch in Rust](https://ferrotensor.dev/training/): pretrain with a byte-level or BPE tokenizer, resume a run, sample from the result - [Questions](https://ferrotensor.dev/faq/): short answers on models, GPUs, memory, Mac and AMD support, GGUF export, Python, and the comparison with Candle, Burn and PyTorch ## Source and packages - [GitHub](https://github.com/puranikyashaswin/ferrotensor): source, issues and releases - [AGENTS.md](https://github.com/puranikyashaswin/ferrotensor/blob/main/AGENTS.md): the CLI for coding agents and scripts, with the JSON output of each command and the exit codes - [crates.io](https://crates.io/crates/ferrotensor-cli): the `ferrotensor-cli` crate - [docs.rs](https://docs.rs/ferrotensor): the Rust API reference - [PyPI](https://pypi.org/project/ferrotensor/): the Python wheel