srijitiyer/alloy

A fast Rust CLI for LLM model merging, diffing, and conversion. 10 merge algorithms, mergekit-compatible configs, safetensors native.

Rust

7

46 commits

updated Apr 18, 2026

See the code
llm
machine-learning
mergekit
model-merging
rust
safetensors

README

alloy

A fast CLI for LLM model merging, format conversion, and diffing. Written in Rust. Reads safetensors natively. Compatible with mergekit configs.

Website · GitHub

Install

cargo install --path .

Requires Rust (any recent stable version).

Usage

# Merge two models
alloy merge config.yaml --output ./merged

# Compare two models tensor-by-tensor
alloy diff ./model_a ./model_b

# Convert dtype (e.g. FP32 to FP16)
alloy convert ./model --output ./model_f16 --dtype f16

# Inspect model metadata
alloy info ./model

Merge methods

MethodDescription
linearWeighted average of N models
slerpSpherical interpolation between 2 models
nuslerpMulti-model SLERP via sequential pairwise interpolation
task_arithmeticBase + scaled sum of task vectors
tiesTrim, elect sign, disjoint merge
dare_linearRandom dropout + rescaled linear merge
dare_tiesDARE dropout + TIES sign election
della_linearMagnitude-aware dropout + linear merge
dellaMagnitude-aware dropout + TIES sign election
passthroughConcatenate layer ranges from different models

Config format

alloy reads mergekit-compatible YAML configs:

merge_method: slerp
base_model: mistralai/Mistral-7B-v0.1
models:
  - model: mistralai/Mistral-7B-v0.1
  - model: teknium/OpenHermes-2.5-Mistral-7B
parameters:
  t: 0.5
dtype: float16

HuggingFace model IDs work directly. Models download to ~/.cache/huggingface/hub/. Set HF_TOKEN for gated models (Llama, Gemma, etc.). PyTorch .bin files are auto-converted on first use.

Benchmarks

Real models on Azure Standard_E48s_v5 (48 cores, 384 GB RAM). All times are wall-clock (hyperfine, 3 runs with warmup).

7B - Mistral-7B-v0.1 (BF16, 14.48 GB)

Methodalloymergekit
linear7.3 s15.4 s2.1x faster
slerp9.5 s12.9 s1.4x faster
ties23.3 s13.1 s1.8x slower
dare_ties38.0 s15.3 s2.5x slower

14B - Qwen2.5-14B (BF16, 29.54 GB)

Methodalloymergekit
linear14.1 s25.8 s1.8x faster
slerp18.5 s22.1 s1.2x faster
ties44.9 s21.9 s2.0x slower
dare_ties75.7 s27.3 s2.8x slower

alloy uses fused SIMD kernels (AVX2/NEON) that read BF16 directly from memory-mapped safetensors and compute in f32 registers, avoiding intermediate allocations. IO-bound methods (linear, slerp) are consistently faster. Compute-heavy methods (ties, dare_ties) are still slower due to PyTorch's optimized C tensor kernels.

See alloy.how for the full technical writeup including architecture, algorithm breakdowns, and future work.

License

MIT

Contributors

srijitiyer

36 commits

Damadimo

8 commits

reyabsaluja

2 commits

srijitiyer/alloy

A fast Rust CLI for LLM model merging, diffing, and conversion. 10 merge algorithms, mergekit-compatible configs, safetensors native.

Rust

7

46 commits

updated Apr 18, 2026

See the code
llm
machine-learning
mergekit
model-merging
rust
safetensors

README

alloy

A fast CLI for LLM model merging, format conversion, and diffing. Written in Rust. Reads safetensors natively. Compatible with mergekit configs.

Website · GitHub

Install

cargo install --path .

Requires Rust (any recent stable version).

Usage

# Merge two models
alloy merge config.yaml --output ./merged

# Compare two models tensor-by-tensor
alloy diff ./model_a ./model_b

# Convert dtype (e.g. FP32 to FP16)
alloy convert ./model --output ./model_f16 --dtype f16

# Inspect model metadata
alloy info ./model

Merge methods

MethodDescription
linearWeighted average of N models
slerpSpherical interpolation between 2 models
nuslerpMulti-model SLERP via sequential pairwise interpolation
task_arithmeticBase + scaled sum of task vectors
tiesTrim, elect sign, disjoint merge
dare_linearRandom dropout + rescaled linear merge
dare_tiesDARE dropout + TIES sign election
della_linearMagnitude-aware dropout + linear merge
dellaMagnitude-aware dropout + TIES sign election
passthroughConcatenate layer ranges from different models

Config format

alloy reads mergekit-compatible YAML configs:

merge_method: slerp
base_model: mistralai/Mistral-7B-v0.1
models:
  - model: mistralai/Mistral-7B-v0.1
  - model: teknium/OpenHermes-2.5-Mistral-7B
parameters:
  t: 0.5
dtype: float16

HuggingFace model IDs work directly. Models download to ~/.cache/huggingface/hub/. Set HF_TOKEN for gated models (Llama, Gemma, etc.). PyTorch .bin files are auto-converted on first use.

Benchmarks

Real models on Azure Standard_E48s_v5 (48 cores, 384 GB RAM). All times are wall-clock (hyperfine, 3 runs with warmup).

7B - Mistral-7B-v0.1 (BF16, 14.48 GB)

Methodalloymergekit
linear7.3 s15.4 s2.1x faster
slerp9.5 s12.9 s1.4x faster
ties23.3 s13.1 s1.8x slower
dare_ties38.0 s15.3 s2.5x slower

14B - Qwen2.5-14B (BF16, 29.54 GB)

Methodalloymergekit
linear14.1 s25.8 s1.8x faster
slerp18.5 s22.1 s1.2x faster
ties44.9 s21.9 s2.0x slower
dare_ties75.7 s27.3 s2.8x slower

alloy uses fused SIMD kernels (AVX2/NEON) that read BF16 directly from memory-mapped safetensors and compute in f32 registers, avoiding intermediate allocations. IO-bound methods (linear, slerp) are consistently faster. Compute-heavy methods (ties, dare_ties) are still slower due to PyTorch's optimized C tensor kernels.

See alloy.how for the full technical writeup including architecture, algorithm breakdowns, and future work.

License

MIT

Contributors

srijitiyer

36 commits

Damadimo

8 commits

reyabsaluja

2 commits

Languages

Rust

82.8%

Python

11.3%

TeX

3.7%

Shell

2.3%