Skip to main content

🚀 Unsloth-Candle

High-performance LLM fine-tuning library built with Rust 🦀 and Candle.

PyPI version License Unsloth


Unsloth-Candle brings the blazing fast performance of Unsloth to the Candle ecosystem. By leveraging optimized Rust kernels and efficient memory management, it enables 2x faster training and 70% less memory usage compared to standard implementations.

✨ Core Advantages

  • Zero Learning Curve: 1:1 API compatibility with Unsloth's Python interface.
  • Hardware Optimized: Native support for CUDA, Metal (Apple Silicon), and AVX/Neon (CPU).
  • Memory Efficient: Native 4-bit NF4 quantization and gradient checkpointing.
  • Unified Support: One engine for Llama 3.2, Mistral, Qwen 2.5, DeepSeek-V3, and more.

📦 Installation

pip install unsloth-candle

Build from Source

git clone https://github.com/unslothai/unsloth-candle.git
cd unsloth-candle
pip install -e .

To enable GPU acceleration:

  • CUDA: pip install -e . --features cuda
  • Metal: pip install -e . --features metal

🛠 Usage

1. Load Model & Tokenizer

from unsloth_candle import FastLanguageModel

model, tokenizer = FastLanguageModel.from_pretrained(
    model_name = "unsloth/Llama-3.2-1B-Instruct",
    max_seq_length = 2048,
    load_in_4bit = True,
)

2. Apply LoRA/DoRA

model = FastLanguageModel.get_peft_model(
    model,
    r = 16,
    target_modules = ["q_proj", "k_proj", "v_proj", "o_proj"],
    lora_alpha = 16,
    use_gradient_checkpointing = True,
    use_dora = False, # Set to True for DoRA
)

3. Fine-tuning with SFTTrainer

from unsloth_candle import SFTTrainer, SFTConfig

trainer = SFTTrainer(
    model = model,
    tokenizer = tokenizer,
    train_dataset = dataset,
    dataset_text_field = "text",
    max_seq_length = 2048,
    args = SFTConfig(
        max_steps = 60,
        learning_rate = 2e-4,
        logging_steps = 1,
    ),
)
trainer.train()

4. Save & Export

# Save as merged HF weights
model.save_pretrained_merged("output_hf", tokenizer)

# Save as GGUF (for Ollama/llama.cpp)
model.save_pretrained_gguf("output_gguf", tokenizer, quantization_type="q4_k_m")

🗺️ Model Catalog

Model Architecture 4-bit LoRA DoRA
Llama 3.2 LlamaForCausalLM ✅ ✅ ✅
Mistral Nemo MistralForCausalLM ✅ ✅ ✅
Qwen 2.5 Qwen2ForCausalLM ✅ ✅ ✅
DeepSeek V3 DeepSeekV3 (MLA) ✅ ✅ ✅
Gemma 3 Gemma3 (GeGLU) ✅ ✅ ✅
Phi 4 Phi4 ✅ ✅ ✅

📜 License

Licensed under the Apache License, Version 2.0.


Built with 💖 by the Unsloth Community and Antigravity.

Metadata

Release files for unsloth-candle-cuda 2026.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for unsloth-candle-cuda 2026.4.1
File Interpreter ABI Platform Actions
unsloth_candle_cuda-2026.4.1-cp313-cp313-manylinux_2_39_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.39+ x86-64 Details for unsloth_candle_cuda-2026.4.1-cp313-cp313-manylinux_2_39_x86_64.whl

Release files / unsloth_candle_cuda-2026.4.1-cp313-cp313-manylinux_2_39_x86_64.whl

Download URL unsloth_candle_cuda-2026.4.1-cp313-cp313-manylinux_2_39_x86_64.whl
Size 4.3 MB
Tags CPython 3.13 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
bd2bfff744970822df488f65d899615462984e9ac22befd170ef4c81468e80e5
BLAKE2b-256 checksum
How to use checksums
1ce9b54851bd1345d45c2aab43e04b628598aace699251999302a9825391d2b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Security for unsloth-candle-cuda 2026.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2026.4.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page