ruvector/scripts/training
rUv db988c90e5 feat(decompiler): pure Rust transformer inference — zero ML dependencies
transformer.rs (416 lines): complete forward pass in std Rust
- Multi-head self-attention with padding mask
- GELU activation, layer norm, softmax
- Loads weights from simple binary format (2.6MB)
- Zero external deps — just f32 math

neural.rs: Backend enum (Transformer/ONNX/Stub)
- .bin → pure Rust (always available, no feature flag)
- .onnx → ort (behind neural feature flag)
- .gguf/.rvf → stub for future RuvLLM integration

export-weights-bin.py: PyTorch → binary weight dump
- 42 tensors, 673,152 parameters, 2.6MB output

56 tests passing, zero warnings.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-03 02:41:47 +00:00
..
data/training feat(training): ADR-129 RuvLTRA training pipeline — calibration, SFT, benchmarks, HF publishing 2026-03-30 07:58:07 -04:00
contamination_check.py feat: implement ADR-129 training pipeline and TurboQuant sidecar infra 2026-03-28 02:27:32 +00:00
deploy_training.sh fix(training): use 3600s timeout for GPU Cloud Run jobs 2026-03-28 12:21:58 +00:00
Dockerfile fix(training): use torch 2.5.1+cu124 (2.3.1 unavailable on cu124 index) 2026-03-28 14:26:28 +00:00
Dockerfile.deobfuscator feat(decompiler): GPU training pipeline for neural name inference (ADR-136) 2026-04-03 02:08:19 +00:00
evaluate-model.py feat(decompiler): ONNX Runtime neural inference + 8,226 training pairs 2026-04-03 02:30:41 +00:00
export-to-rvf.py feat(decompiler): GPU training pipeline for neural name inference (ADR-136) 2026-04-03 02:08:19 +00:00
export-weights-bin.py feat(decompiler): pure Rust transformer inference — zero ML dependencies 2026-04-03 02:41:47 +00:00
export_training_data.py feat: implement ADR-129 training pipeline and TurboQuant sidecar infra 2026-03-28 02:27:32 +00:00
filter-and-augment.py feat(decompiler): ONNX Runtime neural inference + 8,226 training pairs 2026-04-03 02:30:41 +00:00
generate-data-v2.mjs feat(decompiler): ONNX Runtime neural inference + 8,226 training pairs 2026-04-03 02:30:41 +00:00
generate-deobfuscation-data.mjs feat(decompiler): ONNX Runtime neural inference + 8,226 training pairs 2026-04-03 02:30:41 +00:00
launch-gpu-training.sh feat(decompiler): GPU training pipeline for neural name inference (ADR-136) 2026-04-03 02:08:19 +00:00
nightly_train.sh feat: add nightly continuous learning pipeline (ADR-129) 2026-03-28 02:30:25 +00:00
README.md feat: implement ADR-129 training pipeline and TurboQuant sidecar infra 2026-03-28 02:27:32 +00:00
release_gate.py feat: implement ADR-129 training pipeline and TurboQuant sidecar infra 2026-03-28 02:27:32 +00:00
run_calibration.py refactor(training): use ruvllm-native tooling instead of llama.cpp 2026-03-28 13:40:14 +00:00
run_sft.py feat(training): ADR-129 RuvLTRA training pipeline — calibration, SFT, benchmarks, HF publishing 2026-03-30 07:58:07 -04:00
train-deobfuscator.py feat(decompiler): GPU training pipeline for neural name inference (ADR-136) 2026-04-03 02:08:19 +00:00

Training Scripts

Scripts for RuvLTRA model training, evaluation, and release gating.

release_gate.py

Automated ship/no-ship checker implementing the 7 release gates from ADR-129 Section 3.2. No external dependencies -- uses Python stdlib only.

Prerequisites

Generate a gate_results.json file by running the evaluation scripts (eval_humaneval.py, eval_routing.py, eval_perplexity.py, turbo_quant_bench, eval_long_context.py, e2e_bench). The file must be placed in a results directory with the following structure:

{
  "model_size": "0.5B",
  "baseline": {
    "humaneval_pass1": 0.40,
    "routing_accuracy": 0.80,
    "wikitext2_ppl": 25.0
  },
  "candidate": {
    "humaneval_pass1": 0.48,
    "routing_accuracy": 0.83,
    "wikitext2_ppl": 24.5,
    "tq_compression": 10.7,
    "tq_ppl_delta": 0.008,
    "long_context_ppl": 18.0,
    "contamination_count": 0,
    "tok_per_sec": 95
  }
}

Usage

# Basic usage
python scripts/training/release_gate.py --results-dir ./results

# With model path (informational)
python scripts/training/release_gate.py \
  --model-path /models/ruvltra-v2.0-tq \
  --results-dir ./results

# Save JSON report
python scripts/training/release_gate.py \
  --results-dir ./results \
  --output-json ./reports/gate_report.json

Exit codes

Code Meaning
0 All 7 gates PASS -- model is approved to ship
1 One or more gates FAIL -- do not ship

Gates

Gate Criterion 0.5B threshold 3B threshold
G1 HumanEval pass@1 >=45% or >=5pp delta >=55% or >=5pp delta
G2 Routing accuracy >=80% >=80%
G3 Wikitext-2 PPL regression <5% increase <5% increase
G4 TurboQuant compression >=8x, PPL delta <1% >=8x, PPL delta <1%
G5 Long context PPL at 16K <20 PPL <20 PPL
G6 Eval contamination 0 instances 0 instances
G7 Inference speed >=80 tok/s >=40 tok/s

CI integration

# In a GitHub Actions workflow or Cloud Build step:
- name: Release gate check
  run: python scripts/training/release_gate.py --results-dir ./results --output-json ./reports/gate_report.json

If any gate fails, the script exits with code 1, which fails the CI step and blocks publishing.