
Domain Ml
This is your Layer 3 constraint reference for when you're building ML/AI apps in Rust and need to make the right tradeoffs. It maps domain rules like "large data means efficient memory" to concrete Rust implications like zero-copy views and streaming. The big win here is the decision matrix: it tells you tract for ONNX inference-only cases, candle or burn when you need training, tch-rs for PyTorch models. Includes patterns for model singletons with OnceLock and batched inference for GPU efficiency. The "trace down" section connects ML constraints to the right Layer 2 modules, so you're not guessing which skill to reach for when you need async data loading or lazy evaluation.
- skills.sh installs
- 573
- GitHub stars
- 1.3K
- last updated
- Jul 14, 2026
Install
$ npx -y skills add zhanghandong/rust-skills --skill domain-ml --agent claude-codeInstalls into .claude/skills of the current project.
Files
Machine Learning Domain
Layer 3: Domain Constraints
Domain Constraints → Design Implications
| Domain Rule | Design Constraint | Rust Implication |
|---|---|---|
| Large data | Efficient memory | Zero-copy, streaming |
| GPU acceleration | CUDA/Metal support | candle, tch-rs |
| Model portability | Standard formats | ONNX |
| Batch processing | Throughput over latency | Batched inference |
| Numerical precision | Float handling | ndarray, careful f32/f64 |
| Reproducibility | Deterministic | Seeded random, versioning |
Critical Constraints
Memory Efficiency
RULE: Avoid copying large tensors
WHY: Memory bandwidth is bottleneck
RUST: References, views, in-place ops
GPU Utilization
RULE: Batch operations for GPU efficiency
WHY: GPU overhead per kernel launch
RUST: Batch sizes, async data loading
Model Portability
RULE: Use standard model formats
WHY: Train in Python, deploy in Rust
RUST: ONNX via tract or candle
Trace Down ↓
From constraints to design (Layer 2):
Sponsors
Details
- Repository
- github.com/zhanghandong/rust-skills
- Categories
- Data Science & ML, Rust
- First seen
- May 16, 2026
More from zhanghandong/rust-skills
All 34- Domain Iot568
- M15 Anti Pattern5.6K
- Coding Guidelines1.2K
- M10 Performance895
- M07 Concurrency844
- M06 Error Handling827
- Rust Refactor Helper821
- M01 Ownership809
- M04 Zero Cost789
- M05 Type Driven786
- M02 Resource783
- M03 Mutability773
- M12 Lifecycle764
- M14 Mental Model751
- M09 Domain750
- M11 Ecosystem747
- M13 Domain Error738
- Rust Trait Explorer731
- Rust Code Navigator728
- Unsafe Checker726
- Domain Cli709
- Rust Symbol Analyzer702
- Rust Call Graph699
- Rust Router698