lele

Library Listed

Bare-metal machine learning inference library in Rust

Checked · Sources

Downloads
132
Dependents
1
Stars
183
Forks
15
Contributors
2
Commits
336
Latest release
0.2.0 ·

About

From the project README ·

Bare-metal ONNX inference engine in pure Rust.

lele compiles ONNX graphs ahead of time into specialized Rust code and a single weights blob, then runs them with tuned kernels and no runtime dependencies: no interpreter, no ONNX parser at runtime, no C++.

  • Ahead-of-time: graph traversal, fusion, buffer allocation and dispatch are resolved at build time. Each node becomes a direct function call.
  • One SIMD source: the fearless_simd kernels compile to NEON (including int8 dot products), AVX2/FMA, AVX-512 and WASM SIMD128, with scalar fallbacks tested on every target.
  • Quantization: static QDQ, dynamic int8, weight-only int8 and f16 weights.
  • Small deployment: with default-features = false you ship only the generated code and the weights; the ONNX parser is left out.

Upgrading from 0.1.x: 0.2.0 moves the generated-code runtime into lele::runtime and changes parts of the compiler API. Regenerate your models with the matching compiler version.

Read the full README

Models

DomainModelTask
ASRSenseVoice SmallMultilingual speech recognition (int8)
ASRWhisper (base, int8)Multilingual ASR, encoder/decoder with KV cache
ASRT-oneStreaming Russian telephony ASR (8 kHz, CTC)
VADSilero VAD, FireRedVADStreaming voice activity detection
TTSSupertonic 2 / 35 / 31 languages, expression tags
TTSHojo-TTS-LightBilingual ZH/EN voice cloning (0.08B token LM)
TTSMOSS-TTS-NanoEnd-to-end neural TTS with int8 GEMV
VisionYolo26, Yolo26n-SegObject detection, instance segmentation
OCRPP-OCRv6_tinyText detection + recognition

All of the above also run in the browser via WebAssembly.

Performance

Reference measurements, single thread, Apple M2 Pro, against ONNX Runtime (CPU, intra_op_num_threads=1, inter_op_num_threads=1). Speech models use steady-state RTF (warmup plus multi-run average); lower is better.

ModelORTleleSpeedup
Silero VADRTF 0.002882RTF 0.00221.31x
SenseVoiceRTF 0.0294RTF 0.02561.15x
Supertonic 2RTF 0.1667RTF 0.05503.03x
Yolo26704.50 ms534.97 ms1.32x
Yolo26n-Seg126.51 ms64.82 ms1.95x
Hojo-TTS-LightRTF 8.75RTF 6.691.31x
MOSS-TTS-NanoRTF 0.376RTF 0.2931.28x
PP-OCRv6 DET47.78 ms46.83 ms1.02x
PP-OCRv6 REC2.94 ms/region2.33 ms/region1.26x

Kernel-level benchmarks: cargo bench --bench kernels.

Quick start

# Cargo.toml
[dependencies]
lele = "0.2"
Generate from a build script (recommended)
# model.toml
[model]
source = "hf-hub"
repo = "your-org/your-model"
files = [{ file = "model.onnx" }]

[codegen]
class_name = "MyModel"
// build.rs
fn main() -> lele_build::Result {
    // Downloads the model and writes src/mymodel.rs and
    // src/mymodel_weights.bin unless they are up to date.
    lele_build::build_model("model.toml", "src")
}
let weights = std::fs::read("src/mymodel_weights.bin")?;
let model = MyModel::new(&weights);
let output = model.forward(input);

build_models handles several models from one model.toml. HF_ENDPOINT selects a mirror; LELE_SKIP_MODEL_GEN=1 skips generation and LELE_FORCE_REGEN=1 forces it. A download or codegen error fails the build.

Or use the CLI
cargo install --git https://github.com/miuda-ai/lele --bin lele_gen
lele_gen model.onnx src/ MyModel

This writes src/mymodel.rs and src/mymodel_weights.bin. --shape input=1,512, --dim batch_size=1 and --value sr=16000 compile the model for fixed inputs (see below).

Compiler

The compiler builds a typed IR and runs its passes on it: constant and shape folding, dead-code and common-subexpression elimination, operator fusion and buffer allocation. Fusions include activations into convolutions and products, SwiGLU feed-forwards, RMSNorm, ScaleNorm pairs, rotary embeddings, SimAM, Snake, QDQ pairs around integer matmuls, and fused quantized linears.

Fixed inputs let it fold more and size the workspace up front:

[codegen.shapes]   # input shapes by name
input = [1, 512]
state = [2, 1, 128]
[codegen.dims]     # named symbolic dimensions
batch_size = 1
[codegen.values]   # inputs compiled in as constants
sr = 16000

The same settings exist on the Compiler builder (with_input_shape, with_dim, with_input_value). When every shape is known, <Model>Workspace::BYTES is the exact workspace size.

Models that share weights (e.g. a prefill and a decode step of the same transformer) can share one weights file with Compiler::with_shared_weights.

Extending it
use lele::compiler::{Compiler, Optimizations};

let compiler = Compiler::new()
    .with_name("MyModel")
    .with_default_optimizations()
    .with_pass_before_fusion(|graph| { /* rewrite the IR */ })
    .with_override("MyCustomOp", |codegen, w| {
        // Emit Rust code for this operator.
        Ok(())
    });

// Pick optimizations individually:
let compiler = Compiler::new().with_optimizations(Optimizations {
    operator_fusion: false,
    ..Optimizations::all()
});

Examples

./run_sensevoice.sh                 # SenseVoice ASR
./run_silero.sh                     # Silero VAD
./run_supertonic.sh                 # Supertonic 2 TTS
./run_supertonic3.sh                # Supertonic 3 TTS
./run_yolo26.sh                     # Yolo26 detection
./run_yolo26n_seg.sh                # Yolo26n-Seg segmentation
./run_hojo_tts.sh "text"            # Hojo-TTS-Light voice cloning

cargo run --release -p ppocr-example -- image.png
cargo run --release -p fireredvad-example -- in.wav
cargo run --release -p tone-example --bin tone -- in.wav
cargo run --release -p whisper-example --bin whisper -- in.wav --lang en

The browser demo (ASR, TTS, detection, segmentation) lives in examples/web-demo; see its README.

Supported ONNX operators

70+ operators, including:

  • Math: Add, Sub, Mul, Div, Mod, Pow, Sqrt, Neg, Exp, Log, Sin, Cos, Erf, Clip, Round, CumSum, Max, Range, Einsum (partial)
  • NN: Conv, ConvTranspose, ConvInteger, Gemm, MatMul, MatMulInteger, LSTM, GRU, BatchNormalization, InstanceNormalization, LayerNormalization, MaxPool, AveragePool, GlobalAveragePool, Resize
  • Activation: Relu, LeakyRelu, Elu, Sigmoid, Tanh, HardSigmoid, PRelu, Softmax, LogSoftmax, ArgMax, IsNaN
  • Tensor: Reshape, Transpose, Concat, Split, Slice, Gather, GatherElements, ScatterND, ScatterElements, Pad, Expand, Tile, Where, TopK, Trilu, Flatten, Squeeze, Unsqueeze
  • Reduction: ReduceSum, ReduceMean, ReduceMax, ReduceL2
  • Comparison / logic: Equal, Less, Greater, LessOrEqual, GreaterOrEqual, And, Or, Xor, Not
  • Quantization: DynamicQuantizeLinear, QuantizeLinear, DequantizeLinear, QLinearMatMul, FakeQuantize
  • Control flow / signal: If, STFT
  • Other: Shape, Size, Cast, Constant, ConstantOfShape, Identity

Loop is not supported. SiLU is fused into its sigmoid and multiply.

Architecture

ONNX model ──▶ lele-build ──▶ Compiler ──▶ <model>.rs + <model>_weights.bin
                 (download,    (typed IR,        (pure Rust, no runtime deps)
                  cache)        folding,              │
                                fusion,      ┌────────┼────────┐
                                allocation)  ▼        ▼        ▼
                                          Native     WASM    Embedded
                                        (NEON/AVX) (SIMD128)

License

MIT

Runs on
GPU support unknown
What shows it
  • no dependency or feature matches a backend row
Native code
None found
  • No native code found
Python bindings
No Python binding crate found
License
MIT

Compare with similar projects

Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.

lele beside the projects that share a topic with it
ProjectDownloadsDependentsStarsLatest releaseRuns on (GPU)Native codeLicense
lele This page Listed

Bare-metal machine learning inference library in Rust

132 downloads over 30 days 1 183 0.2.0 GPU support unknown No native code found MIT
ort Featured

A safe Rust wrapper for ONNX Runtime 1.31 - Optimize and accelerate machine learning inference & training

3,902,768 downloads over 30 days 694 2,611 2.0.0-rc.15 CUDA, WebGPU, ROCm Binds native code: onnxruntime, ort-sys. Build uses a native toolchain: pkg-config (feature pkg-config) Apache-2.0 OR MIT
rten Featured

Tensor library for the RTen machine learning runtime

496,924 downloads over 30 days 29 360 0.27.0 GPU support unknown No native code found Apache-2.0 OR MIT
musicgpt App Listed Dormant

Generate music based on natural language prompts using LLMs running locally

7,531 binary downloads per release Not applicable 1,471 0.3.27 CUDA Binds native code: alsa-sys, openssl-sys, ort-sys MIT
blazr App Listed

Inference server for LLMs, speech and embeddings: OpenAI-compatible routes with streaming, plus speech synthesis (TTS) and transcription (ASR). Serves Llama, Mistral, Qwen, Mamba2, MLA+MoE and hybrid models from SafeTensors, AWQ, GPTQ and GGUF.

8 binary downloads per release Not applicable 7 0.7.1 CUDA, WebGPU Binds native code: ring (feature distributed) Apache-2.0
orkhon Listed Dormant

Machine Learning Inference Framework and Server Runtime

Python bindings

0 downloads over 30 days 0 153 0.2.3 GPU support unknown No native code found MIT
Why ListedNo archive, New or Featured rule places it, so it is Listed.

What it lacks for Featured

  • It has 0 active dependents and 0 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days. The repository route reads 183 stars, 15 forks and 2 contributors. It needs 4,539 stars, 434 forks and 79 contributors together.

What else the check found

  • The last activity is on 5 Nov 2026, 4 days ago. The rules expect an update within 365 days. Dormancy rule

Exact rules: Listed, Featured library. The check on applied thresholds version 9.

Every rule outcome, as the check records it
  • expected-interval: version 0.2.0 base 80, raised to the 365-day floor: E = 365 days
  • dormancy: last activity 2026-11-05, 4 days ago, E = 365: active
  • featured: not featured: active_users 0 < 11 and new_adopters 0 < 9 and repository route stars 183 (needs 4539), forks 15 (needs 434), contributors 2 (needs 79)
  • listed: listed: no archive, new or featured rule applies

Measurements and sources

Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.

Sources6 sources
Adoption0 active dependents, 0 new dependents in 365 days1 not measured
Adoption measurements
SignalValueSourceFetchedCounts
Active dependents0crates.io database dumpYes
New dependents (365 days)0crates.io database dumpYes
Peak active dependents0crates.io database dumpYes
Active dependents as a share of the peak1crates.io database dumpYes
Binary downloads per releaseNot measuredYes
MaintenanceLatest human commit: 4 days ago3 not measured
Maintenance measurements
SignalValueSourceFetchedCounts
Latest human commit2026-11-05GitHub repositoryYes
Latest release2026-11-05crates.io database dumpYes
First release2026-01-29crates.io database dumpYes
Latest version0.2.0crates.io database dumpYes
Days the oldest outside issue waits for a reply146GitHub repositoryYes
Maintainer replies over 365 days0GitHub repositoryYes
Repository archivedfalseGitHub repositoryYes
Repository gonefalseGitHub repositoryYes
Release commit or manifest in the repotruecrates.io packageYes
Published docstruecrates.io database dumpYes
Latest release fails cargo checkNot measuredYes
Build check dateNot measuredYes
Build check toolchainNot measuredYes
SecurityUnpatched vulnerabilities: none
Security measurements
SignalValueSourceFetchedCounts
Unpatched vulnerabilities past the grace windownoneRustSec advisory databaseYes
RustSec unmaintained advisorynoneRustSec advisory databaseYes
Deprecation noticenonecrates.io database dumpYes
Deprecated requirementnonecrates.io database dumpYes
Distribution15 releases, 132 downloads over 30 days5 not measured
Distribution measurements
SignalValueSourceFetchedCounts
Releases15crates.io database dumpYes
Downloads over 30 days132crates.io database dumpYes
Binary downloads over the last 3 releasesNot measuredYes
Homebrew installs on request over 365 daysNot measuredYes
Repology repository familiesNot measuredYes
Docker pull growth over 90 daysNot measuredYes
Docker pulls at the growth baselineNot measuredYes
Every version a prereleasefalsecrates.io database dumpYes
Every version 0.0.xfalsecrates.io database dumpYes
Every version yankedfalsecrates.io database dumpYes
Crate deleted from crates.iofalsecrates.io database dumpYes
Repository183 stars, 15 forks, 2 contributors, 336 commits. Stars alone never qualify a project.
Repository measurements
SignalValueSourceFetchedCounts
GitHub stars183GitHub repositoryYes — one part of the repository route
GitHub forks15GitHub repositoryYes — one part of the repository route
Contributors with a GitHub account2GitHub contributorsYes — one part of the repository route
Commits on the default branch336GitHub repositoryNo
Repository's main crate left out of the entrynonecrates.io database dumpYes
Facts that never count
Facts that never count measurements
SignalValueSourceFetchedCounts
LicenseMITcrates.io database dumpNo
Runs on, from listed crates and their direct dependenciesGPU support unknowncrates.io database dumpNo
What shows each backendno dependency or feature matches a backend rowcrates.io database dumpNo
Native code, from listed crates and their dependenciesNo native code foundcrates.io database dumpNo
Python bindings, from direct dependencies of listed cratesNo Python binding crate foundcrates.io database dumpNo
Crates that depend on a listed crate directly1crates.io database dumpNo

Corrections and review history

Report a correction

No correction applies to this entry.

Judgments

A judgment enters only through an approved issue and a merged pull request.

No judgment applies to this entry.