back to home

paiml / aprender

Next Generation Machine Learning, Statistics and Deep Learning in PURE Rust

76 stars
12 forks
99 issues
RustShellMakefile

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing paiml/aprender in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/paiml/aprender)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

aprender A production-ready machine learning library written in pure Rust. --- Aprender provides implementations of classical machine learning algorithms optimized for performance and safety. The library requires no external dependencies beyond the Rust standard library and offers seamless compilation to WebAssembly. Table of Contents • Features • Installation • Usage • Algorithms • Model Persistence • Documentation • Claude Code Skills • Contributing • License Features • **Pure Rust** — Zero C/C++ dependencies, memory-safe, thread-safe by default • **SIMD Acceleration** — Vectorized operations via trueno backend • **GPU Inference** — CUDA-accelerated inference via realizar (67.8 tok/s 7B, 240 tok/s 1.5B single-decode, 851 tok/s 1.5B batched) • **Multi-Format** — Native , SafeTensors (single + sharded), and GGUF support • **WebAssembly Ready** — Compile to WASM for browser and edge deployment • **11,251 Tests** — 96.35% coverage, zero SATD, TDG 96.9/100 A+ Installation Add aprender to your : Optional Features | Feature | Description | |---------|-------------| | | AES-256-GCM encryption for model files | | | Ed25519 digital signatures | | | Zstd compression | | | Hugging Face Hub push/pull support | | | GPU acceleration via wgpu | Usage Algorithms Supervised Learning | Algorithm | Description | |-----------|-------------| | | Ordinary least squares regression | | | Binary and multiclass classification | | | GINI-based decision trees | | | Bootstrap aggregating ensemble | | | Adaptive boosting with residual learning | | | Gaussian naive Bayes classifier | | | k-nearest neighbors | | | Support vector machine with hinge loss | Unsupervised Learning | Algorithm | Description | |-----------|-------------| | | k-means++ initialization with Lloyd's algorithm | | | Density-based spatial clustering | | | Principal component analysis | | | Anomaly detection | Additional Modules • **Graph Analysis** — PageRank, betweenness centrality, community detection • **Time Series** — ARIMA forecasting • **Text Processing** — Tokenization, TF-IDF, stemming, chat templates • **Neural Networks** — Sequential models, transformers, mixture of experts • **Metaheuristics** — ACO, Tabu Search, DE, PSO, GA, CMA-ES Chat Templates Format LLM conversations for different model families with automatic template detection: **Supported Formats:** | Format | Models | System Prompt | |--------|--------|---------------| | ChatML | Qwen2, Yi, OpenHermes | Yes | | Llama2 | TinyLlama, Vicuna, LLaMA 2 | Yes | | Mistral | Mistral-7B, Mixtral | No | | Phi | Phi-2, Phi-3 | Yes | | Alpaca | Alpaca, Guanaco | Yes | | Raw | Fallback | Passthrough | | Custom | Any (Jinja2) | Configurable | See for complete usage. **Verification:** All templates are 100% tested via bashrs probar playbooks. See for coverage status. Related Crates | Crate | Description | |-------|-------------| | | TSP solver with CLI and model persistence | | | AI-powered shell completion trained on your history | Resources | Resource | Description | |----------|-------------| | apr-cookbook | 50+ idiomatic Rust examples for format, WASM deployment, and SIMD acceleration | Model Persistence The format provides secure, efficient model serialization: Format Capabilities • **Security** — AES-256-GCM encryption, Ed25519 signatures, X25519 key exchange • **Performance** — Memory-mapped loading, 600x faster than standard deserialization • **Integrity** — CRC32 checksums with automatic corruption detection • **Commercial** — License blocks, watermarking, buyer-specific encryption APR CLI Tool The CLI provides comprehensive model operations for the format. Installation Commands | Command | Description | |---------|-------------| | | Run model directly (auto-download, cache, execute) | | | Start inference server (REST API, streaming, metrics) | | | Interactive chat with language models | | | Inspect model metadata, vocab, and structure | | | Simple debugging output ("drama" mode available) | | | Validate model integrity and quality | | | Compare two models | | | List tensor names, shapes, and statistics | | | Layer-by-layer trace analysis | | | Check for best practices and conventions | | | Explain errors, architecture, tensors, and kernel pipelines | | | Regression testing via tensor statistics | | | Export to SafeTensors, GGUF formats | | | Import from HuggingFace, SafeTensors | | | Download and cache model from HuggingFace (Ollama-style UX) | | | List cached models | | | Remove model from cache | | | Compile model into standalone executable (APR-SPEC §4.16) | | | Quantization (int8, int4, fp16) and optimization | | | Streaming quantization (int8, int4, fp16, q4k) with plan mode | | | Merge models (average, weighted strategies) | | | Interactive terminal UI | | | Export for visual testing | | | Model architecture tree view | | | Hex dump tensor data | | | Data flow visualization | | | Benchmark throughput (spec H12: >= 10 tok/s) | | | Evaluate model: perplexity (LM) or classification metrics (--task classify) | | | Deep profiling with Roofline analysis | | | Falsifiable QA checklist for model releases | | | Cross-subcommand smoke test (does every tool handle this model?) | | | Qwen2.5-Coder showcase demo | | | Model self-test: 10-stage pipeline integrity check | | | Publish model to HuggingFace Hub | | | ComputeBrick pipeline monitor | | | Compare APR model against HuggingFace source | Quick Examples Streaming Quantization (ALB-093) Direct SafeTensors to Q4K APR streaming quantization with bounded memory. Quantize models of any size without loading the full model into RAM. **How it works:** • Reads shards one at a time via mmap ( ) • Each tensor flows through: dequant to f32, validate (NaN/Inf), quantize Q4K, stream write • Norm, embedding, bias, and small tensors kept at F32 (precision-critical) • Peak memory bounded by largest single tensor (~2-4 GB), not model size **Results on Qwen3-Coder-30B-A3B-Instruct (57 GB, 16 shards, 18,867 tensor…