Skip to main content

aprender/models/
mod.rs

1//! Pre-trained model architectures for inference.
2//!
3//! This module provides ready-to-use model implementations that combine
4//! the primitives from `nn` into complete architectures.
5//!
6//! # Available Models
7//!
8//! - `Qwen2Model` - Qwen2-0.5B-Instruct decoder-only transformer
9//!
10//! # Design Philosophy
11//!
12//! Models follow the "assembly pattern" - they compose existing primitives
13//! (attention, normalization, feedforward) rather than duplicating code.
14//!
15//! ```text
16//! ┌─────────────────────────────────────────────────────────────────┐
17//! │                     Model Architecture                           │
18//! ├─────────────────────────────────────────────────────────────────┤
19//! │                                                                  │
20//! │   ┌─────────────┐    ┌─────────────────────┐    ┌────────────┐  │
21//! │   │ Embedding   │ -> │  N × DecoderLayer   │ -> │ LM Head    │  │
22//! │   │ (vocab→d)   │    │  (GQA + FFN + Norm) │    │ (d→vocab)  │  │
23//! │   └─────────────┘    └─────────────────────┘    └────────────┘  │
24//! │                                                                  │
25//! └─────────────────────────────────────────────────────────────────┘
26//! ```
27//!
28//! # References
29//!
30//! - Bai et al. (2023). "Qwen Technical Report"
31//! - Vaswani et al. (2017). "Attention Is All You Need"
32
33pub mod qwen2;
34
35pub use qwen2::Qwen2Model;