APR (Aprender Portable Runtime) is a binary format optimized for ML model deployment.
- Zero-copy loading - No parsing, direct memory access
- Compile-time embedding - Works with
include_bytes!()
- Cross-platform - Native, WASM, embedded
- Security - Optional encryption and signing
┌────────────────────────────────────────┐
│ Magic (4 bytes): "APRN" │
├────────────────────────────────────────┤
│ Version (2 bytes): major.minor │
├────────────────────────────────────────┤
│ Flags (2 bytes): compression, etc. │
├────────────────────────────────────────┤
│ Header length (4 bytes) │
├────────────────────────────────────────┤
│ Payload length (8 bytes) │
├────────────────────────────────────────┤
│ Metadata (variable) │
│ - Name (null-terminated string) │
│ - Description (optional) │
│ - Custom fields │
├────────────────────────────────────────┤
│ Payload (variable) │
│ - Tensor data │
│ - Model weights │
│ - Optionally compressed (zstd) │
└────────────────────────────────────────┘
| Bit | Name | Description |
| 0 | Compressed | Payload is zstd compressed |
| 1 | Encrypted | Payload is AES-256-GCM encrypted |
| 2 | Signed | Ed25519 signature present |
| 3-15 | Reserved | Future use |
| Version | Features |
| 1.0 | Initial release, basic bundling |
| 1.1 | Compression support (zstd) |
| 1.2 | Encryption (AES-256-GCM) |
| Feature | APR | SafeTensors | GGUF | ONNX |
| Zero-copy | ✅ | ✅ | ❌ | ❌ |
| Rust-native | ✅ | ❌ | ❌ | ❌ |
| WASM support | ✅ | ✅ | ❌ | ❌ |
| Encryption | ✅ | ❌ | ❌ | ❌ |
| Quantization | ✅ | ❌ | ✅ | ✅ |