Rust
6 stars
Learning-focused LLM inference engine built from scratch in Rust, exploring tensors, memory, model loading, attention, KV cache, and serving.
### Overview:
Morphogenesis is a learning-focused LLM inference engine built from scratch in Rust, designed to explore tensors, memory, model loading, attention, KV cache, and serving. The engine is memory-bandwidth-bound, with every weight read exactly once per token and used for a single multiply-accumulate against a vector. The goal is to understand how an LLM actually runs by simulating a disk-based engine.
### Key Features:
- **Disk-Based Inference**: Forces the engine to account for every single byte that moves, providing a clear understanding of how an LLM operates.
- **Quantization and Sparsity**: Reduces memory usage by quantizing weights and using sparsity.
- **Model Loading**: Supports various file formats including pickle, safetensors, GGUF, and ONNX, with exact byte layouts.
- **Tokenizer Verification**: A reference implementation has been verified to ensure accuracy.
### Tech Stack:
Rust
### Why It Matters:
Understanding the intricacies of how an LLM runs, particularly in terms of memory and bandwidth usage, is crucial for optimizing and improving performance. By simulating a disk-based engine, one can gain insights into the bottlenecks and optimizations that are essential for efficient inference.
### Repository:
Repository: kashifnawazz/morphogenesis
GitHub Stars: 6
GitHub Description: Learning-focused LLM inference engine built from scratch in Rust, exploring tensors, memory, model loading, attention, KV cache, and serving.
### Status:
**Early. No inference yet.** Currently: the model is downloaded, the