# native_neural_network - Quickstart
## Requirements
- Rust stable (recommended: latest stable)
- Project root: this repository (`Cargo.toml` at root)
## Build Check
```bash
cargo check
```
## Generate Sample Models
```bash
cargo run --example generate_sample_model
```
Generated files:
- `/tmp/sample_f32.rnn`
- `/tmp/sample_f64.rnn`
## Train Commands
The repository exposes cargo aliases for training bins:
```bash
cargo train_small_model
cargo train_medium_model
cargo train_large_model
cargo train_enormous_model
```
## Training Storage Behavior
Training writes to existing files and appends history instead of creating new file names.
For each precision (`trained/f32` and `trained/f64`):
- model: `trained/<precision>/<model>.rnn`
- benchmark blob: `trained/<precision>/benchmark/<model>.bmk`
- benchmark timeline: `trained/<precision>/benchmark/<model>.csv`
- benchmark text exports: `trained/<precision>/benchmark/<model>.json` and `.yaml`
Important behavior:
- `.rnn`, `.bmk`, `.csv`, `.json`, `.yaml` are appended in place
- training resumes from the latest stored model snapshot
- global counters (`elapsed_ms`, `iterations`) resume from previous CSV state
## Quick Verification
After running a training command twice, verify that history grows:
```bash
for f in trained/f32/benchmark/*.csv trained/f64/benchmark/*.csv; do
headers=$(grep -c '^model,precision,elapsed_ms,iterations,train_samples,avg_loss,last_loss,iterations_per_sec,samples_per_sec$' "$f")
runs=$(awk -F, 'NR==1{prev=-1; r=0; next} {e=$3+0; if(prev>=0 && e<prev) r++; prev=e} END{print (NR>1)?(r+1):0}' "$f")
echo "$f lines=$lines headers=$headers estimated_runs=$runs"
done
```
Expected:
- `lines` increases over time
- `headers` stays `1`
- `estimated_runs` increases after each new training launch
## FFI and Wrappers
- C header: `include/rnn_api.h`
- Rust FFI implementation: `src/ffi_api/ffi_api.rs`
- Wrappers: `wrappers/cpp`, `wrappers/java`, `wrappers/javascript`, `wrappers/python`
The benchmark FFI structs are aligned across Rust/C/Python/Java/C++.
## Notes
- No UI is bundled.
- This quickstart focuses on local build, sample generation, and training lifecycle.