Skip to content

Latest commit

 

History

History
1456 lines (1122 loc) · 70 KB

File metadata and controls

1456 lines (1122 loc) · 70 KB

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Added

CPU/GPU output parity contract (jidoka armor)

  • contracts/apr-cpu-vs-gpu-output-parity-v1.yaml — new provable contract codifying the CPU-vs-GPU output-parity invariant for apr run / apr serve (#1427). Authored after SHIP-007 evidence v5 confirmed the GPU forward path emits gibberish on the canonical Qwen2.5-Coder-7B teacher while the CPU path returns correct output. Contract progressed v1.0.0 → v1.5.0 ACTIVE with 5/5 falsifiers DISCHARGED in a single 2-PR cycle (#1445 + #1446) — first contract in the SHIP-TWO program to reach complete-evidence terminal state.
  • CUDA fallback log prefix ([apr-cpu-vs-gpu-output-parity-v1] CUDA path rejected) — the CUDA fallback decision is now visible without --verbose (#1428). Drift-prevention test pins the contract tag verbatim (#1429).
  • wgpu fallback log prefix + cosine parity gate ([apr-cpu-vs-gpu-output-parity-v1] wgpu path rejected ...) — the wgpu inference path now emits a structured rejection log AND runs an inline CPU-vs-GPU cosine parity check on the embedding stage; below threshold, the GPU path fails closed and execution falls back to CPU (#1435, #1440, #1442). Closes the silent-GPU-gibberish failure mode end-to-end.
  • Live discharge evidence — full chain verified on canonical broken-GPU teacher with both default (apr run model.apr) and --no-gpu smokes; smoke logs + findings stored under evidence/cpu-gpu-005-live-discharge-2026-05-04/.

apr trace --save-tensor — SHIP-007 layer-0 oracle bisection

  • apr trace --save-tensor <stages> — new flag captures per-stage forward-pass tensor dumps in APRT byte format for element-wise GPU/CPU bisection (#1405, #1408, #1413, #1414, #1417). Scaffolded by contracts/apr-cli-trace-save-tensor-v1.yaml (v1.1.0 → v1.4.0 FUNCTIONAL) with falsifiers FALSIFY-009/010/011 promoted from PARTIAL_ALGORITHM_LEVEL → FUNCTIONAL.
  • apr diff --values recognizes APRT stage tensors (#1413) — closes the trace→diff loop without round-tripping through SafeTensors.
  • HF FP16 oracle bisection scriptscripts/ship-007-layer0-oracle/ runs the Qwen2.5-Coder-7B HF FP16 reference forward pass and pinpoints the SHIP-007 divergence to layer-0 attn_out (cos=0.99999995 at attn_norm → cos=0.9966 after attention block) (#1423, #1426). First empirical confirmation that the bug lives inside the attention block (qkv/RoPE/softmax/V/O), not before.

Distillation training contract

  • contracts/apr-cli-distill-train-v1.yaml — 9 falsifiers all algorithm-bound at PARTIAL_ALGORITHM_LEVEL (#1438, #1439, #1443, #1444). Sweep closes 9/9 with TRAIN-009 explicitly classified BLOCKER_FIXTURE_ABSENT.
  • DistillationLoss falsifier-parity coveragehf_pipeline DistillationLoss tests added for FALSIFY-TRAIN-003/004 (#1436).

Specification amendments — SHIP-TWO-001

  • Spec v2.86.0 → v2.87.0 → v2.88.0 → v2.89.0 → v2.90.0 records the §41/§42/§43/§44/§45 jidoka chain and the 5/5 LIVE DISCHARGE milestone on apr-cpu-vs-gpu-output-parity-v1. MODEL-1 ship % now 91%, coverage tally 15+37 → 20+32.

Performance

  • MoE expert dispatch parallelized with rayon — 2× speedup (#1396) on apr-cpu-vs-gpu-output-parity-v1 MoE inference path (forward_qwen3_moe). Discharges qwen3-moe-forward-v1 v1.3.0 → v1.4.0 FUNCTIONAL.
  • APR file mmap in load_tensor_f32 (#1058) — unblocks apr diff --values on 7B-parameter models (was 12+ min for limit=20, now 192s for full 339-tensor sweep).

Fixed

M32d numerical parity (Qwen3-MoE)

  • Qwen3-MoE numerical-parity bundle — fixes 4 root-cause bugs (Q/K RMSNorm rank-3 reshape, rope_theta default rank-4, chat template emission, traced sync) that produced gibberish on Qwen3-Coder-30B-A3B (#1228). Multi-domain dogfood (math/geo/translate/code) now correct end-to-end.

Hub build chain

  • aprender-train --features hub build chain repaired (#1432, #1433, #1434): quantize_to_gguf_bytes match-result binding, empty-input early return, GGUF tensor-data alignment padding accounted for in test helpers.

Documentation

  • README claims updated against contracts/readme-claims-v1.yaml drift gate: 1096 → 1105 contracts, 79 → 80 CLI commands. bash scripts/check_readme_claims.sh is GREEN against HEAD.

Provable contracts (algorithm-binding sweep)

This release closes a record contract algorithm-binding sweep — 150+ provable contracts flipped from unbound to PARTIAL_ALGORITHM_LEVEL across kernel, format, training, GPU-backend, and CLI families (commits in the 50-200 range above v0.31.2). Each binding ties an existing falsifier to a concrete, executable algorithm reference, preserving the YAML→code audit story without claiming live discharge.

Sweep highlights: AdamW, RMSNorm, GQA, RoPE, SwiGLU, Q4K/Q6K superblocks, paged-KV-cache, sliding-window attention, attention-scaling, fused-QKV, NF4 fused gate-up/RMSNorm-GEMV/QKV/tensor-core GEMM, LoRA algebra, QLoRA hyperparameters, online-softmax, flash-attention, speculative-decoding, MoE router/dispatch, classification metrics, regression metrics, ranking metrics, clustering metrics, BPE training/loading, dataset-thestack-python, document-integrity, eval-harness HumanEval, GPU multi-backend parity, training-loop-pretrain, eval-sharding, chat-template, qwen2/qwen3/qwen3-moe/qwen35 shapes + e2e-verification, apr-cli-{publish,pull-dataset,qa,operations,coverage,publish-extra,dep-migration,command-safety,distill-train}-v1, apr-{provenance,inspect-*,model-{diagnostics,graph,lifecycle,optimization,qa,security},mcp-server,mono-binary-rule,chat-session,claude-proxy,chrome-trace,gpu-{presence,diagnostics,parity-consistency},docs,org-taxonomy,page-*,corpus-*,book-*,tool-*,qa-{chaos,coverage,differential,metamorphic,silent-fallback},serve,stochastic-lr,zero-feature-gate,version-traceability,compare-hf-nonvacuous,architecture-schema}-v1.

[0.31.1] - 2026-04-19

Fixed

  • apr qa format_parity gate now SKIPs when the primary model is non-GGUF (SafeTensors, APR, ONNX) instead of FAILing the overall QA run (#907). Matches the pre-existing SKIP semantics of the 5 other inference-only gates when golden-output / golden-input / reference tokenizer are unavailable. Regression tests assert skipped=true && passed=true for both SafeTensors and APR primaries.

Added

  • MCP M5 scaffold (#908) — optional pmcp = "2.3" dependency on aprender-mcp behind a new pmcp-dispatcher feature flag (default off). Zero behaviour change: the hand-rolled stdio dispatcher still runs by default. Unblocks the M5 migration path (pmcp::Server delegation + FALSIFY-MCP-009 byte-identical parity test + SSE/WebSocket transports).

[0.31.0] - 2026-04-19

Added

MCP Server (Milestones M1–M3)

  • apr mcp — new subcommand exposing 9 apr tools over stdio JSON-RPC 2.0. M1 skeleton (#864), then progressively added apr.validate (#865), apr.tensors + apr.bench (#866), apr.qa + apr.trace (#867), apr.run (#870), apr.serve (#872), apr.finetune (#881). Dispatcher hardened under FALSIFY-MCP-005 + FALSIFY-MCP-007 (#868).
  • Tool schemas codegen from YAMLcrates/aprender-mcp/build.rs emits APR_<TOOL>_SCHEMA + APR_<TOOL>_DESCRIPTION constants from contracts/apr-mcp-tool-schemas-v1.yaml (#871) so schema + description cannot be hand-edited out of sync with the contract (FALSIFY-MCP-008 — #880 kickoff, #884 completes migration for all 9 tools).
  • MCP notificationsnotifications/cancelled for SIGTERM→SIGKILL on long-running jobs (FALSIFY-MCP-006 — #883) and notifications/progress for apr.finetune (FALSIFY-MCP-PROGRESS-001 — #887).
  • JSON Schema Draft 7 meta-validation on every tool input schema in CI (FALSIFY-MCP-002 strict — #869).
  • MCP book chapter documenting .mcp.json client config (#874, #885).

apr code — Claude Code parity epic CLOSED

contracts/apr-code-parity-v1.yaml v5.1 — 21 rows: 14 SHIPPED / 3 PARTIAL / 4 NONE. Epic PMAT-CODE-PARITY-MATRIX-001 closure conditions met (SHIPPED ≥9 AND MISSING ≤4). 10 tickets closed in a single cycle:

  • P0 (4): MCP client tool registration in agent/code.rs (PMAT-CODE-MCP-CLIENT-001, v4), SlashCommand enum 11→21 variants (PMAT-CODE-SLASH-PARITY-001, v4.2), hook surface + SessionStart runtime wiring (PMAT-CODE-HOOKS-001, v4.3), Task-tool subagent spawn (PMAT-CODE-SPAWN-PARITY-001, v4.4).
  • P1 (5): custom agents discovery from .apr/agents/ + .claude/agents/ (PMAT-CODE-CUSTOM-AGENTS-001, v4.5), privacy-gated NetworkTool/BrowserTool (PMAT-CODE-WEB-TOOLS-001, v4.6), skills discovery from .apr/skills/ + .claude/skills/ (PMAT-CODE-SKILLS-001, v4.7), git worktree isolation primitives (PMAT-CODE-WORKTREE-001, v4.8), permission-mode lattice (PMAT-CODE-PERMISSIONS-001, v4.9).
  • P2 epic-closing (2): REPL status-line primitive (PMAT-CODE-STATUS-LINE-001, v5.0), managed org policy loader at /etc/apr-code/CLAUDE.md with /etc/claude-code/CLAUDE.md fallback and UTF-8-safe size cap (PMAT-CODE-ORG-POLICY-001, v5.1 — epic-closing flip).

Contracts harness

  • pv check-parity — SEMANTIC gate for parity-matrix contracts (FALSIFY-CODE-PARITY-001..005). Runs each row's cross_check_command with expected_min_hits / expected_max_hits and enforces the headline aggregate invariant (FALSIFY-CODE-PARITY-002). Dogfooded aprender-contracts-cli binary — bash/python scripts for contract validation are now explicitly forbidden by CLAUDE.md.
  • apr-claude-proxy-v1.yaml — new provable-contract proxy contract pinning apr serve anthropic (Claude Messages-API drop-in), model fallback chain, SSE event sequence, and six FALSIFY-CLAUDE-PROXY gates (DRAFT, promotes to ENFORCED at M6-α).

SHIP-TWO-001 — first sovereign published model

  • SPEC-SHIP-TWO-001 v2.0 — first sovereign published model. paiml/qwen2.5-coder-7b-apache-q4k-v1 (teacher checkpoint, 7.5 GB .apr, Apache-2.0) published to HuggingFace Hub. First artifact to pass the full apr publish contract (schema + sha256 + SPDX + recipe + parent-chain).
  • apr qa --require-golden-output — promotes the Golden Output gate from a soft skip to a hard ship-blocker. When set, a SKIPPED golden_output gate (tokenizer missing, --skip-golden, inference-feature-off build) becomes a FAIL instead of a silent pass. Closes the hole that let a distilled checkpoint emit garbage for 14 days before audit.
  • apr validate-manifest — new subcommand implementing contracts/publish-manifest-v1.yaml FALSIFY-PM-001..006 in pure Rust: schema conformance (12 top + 7 provenance), sha256 stream-hash vs local artifact, SPDX license allowlist, recipe_sha256 reproducibility, and parent-chain termination. Closes the AC-EX-004 tool-gap — prior pyyaml helper was not runnable from the canonical binary.
  • apr validate-manifest --live — discharges FALSIFY-PM-003 (URL HEAD + content-length match) and FALSIFY-PM-002-live (streaming GET + sha256) natively via ureq. Dogfoods F-PUBLISH-EXTRA-001::dogfood_ex05 — scripts/ship-two-001/ex-05-verify-manifest.sh no longer invokes external interpreters, eliminating the Python dependency from the ship path. Contract apr-cli-publish-extra-v1.yaml bumped to v1.1.0 with FALSIFY-PUB-EXTRA-008.
  • FALSIFY-PM-007 safetensors header dtype Poka-Yokeapr validate-manifest --artifact model.safetensors parses the safetensors header JSON and verifies per-tensor dtype matches manifest.quantization (fp16→F16, bf16→BF16, fp32→F32). Weight tensors must match; norm/bias tensors may stay F32. Would have caught the 30.46 GiB F32 fp16-manifest bug at publish time. Contract publish-manifest-v1.yaml bumped to v1.1.0 with 8 unit tests (including the exact ship-blocker scenario from SHIP-TWO-001 §12.7.2).
  • contracts/publish-manifest-v1.yaml — schema + 6 falsification tests (PM-001..006) for model artifact publish manifests. Covers sha256 integrity, URL liveness, SPDX license validity, recipe reproducibility, and parent-chain termination.
  • contracts/eval-sharding-v1.yaml + scripts/ship-two-001/eval-shard.sh + eval-shard-merge.py — parallel eval lane for future multi-host HumanEval/MBPP/BigCodeBench runs. Round-robin stride sharding, Chen et al. unbiased merge, 4 falsification gates (completeness, disjointness, determinism parity, merged-score identity). FALSIFY-SHARD-004 empirically discharged: Δ=0.0039 pp on the real teacher eval JSON (inside 0.01 pp parity bar).

Model / format

  • ALB-093 / GH-434: streaming APR→Q4K path for ≥4 GiB models — enables training/fine-tuning at model scales that previously OOM'd on the single-pass quantize path. (#749)
  • GH-375: GGUF Q4_0/Q5_0/Q8_0 import fallbackapr import of GGUF files with unsupported quantization types (Q4_0, Q5_0, Q8_0) now falls back to dequant-requant path instead of failing. Raw import preserves Q4_K/Q6_K exactly; legacy types go through f32 intermediate with optional --quantize q4k.
  • GH-90: Honest brick benchmarksapr bench --brick no longer times a no-op budget() call (which reported 0.02us / 55M tok/s). Bricks without run() implementations now report their analytical budget estimate with a clear "ANALYTICAL" label. Use apr bench --fast for real measured throughput.

New CLI surfaces

  • apr serve plan now accepts HuggingFace repo IDs (hf://org/repo or bare org/repo)
    • Fetches only ~2KB config.json — no weight download needed
    • Computes VRAM budget, throughput estimates, and contract checks from architecture params alone
    • New --quant flag to specify quantization for HF models (e.g., --quant Q4_K_M)
    • Handles gated models (401/403) with clear auth instructions
    • Cross-validated: HF path produces identical estimates to local GGUF for same model
  • apr eval --task classify: Classification evaluation against JSONL test sets
    • 13 metrics: accuracy, top-2 accuracy, Cohen's kappa, MCC, per-class P/R/F1, Brier score, log loss, ECE
    • Bootstrap 95% confidence intervals on accuracy, macro F1, MCC
    • Baselines (random, majority-class, lift)
    • Error analysis (top-5 most confused class pairs)
    • --json for machine-readable output
    • --generate-card writes HuggingFace model card (README.md) to checkpoint directory
    • New args: --task, --data, --model-size, --num-classes, --generate-card
  • apr compile subcommand: build standalone executables with embedded .apr models (APR-SPEC §4.16)
    • Generates temporary Cargo project with include_bytes! model embedding
    • Supports --release, --strip, --lto size optimization flags
    • Cross-compilation via --target (10 native + WASM targets)
    • --list-targets enumerates available compilation targets
    • JSON output with --json
  • Architecture help text now lists all recognized --arch values: starcoder, gemma, falcon, mamba, t5
  • --arch gemma (and gemma2, gemma3) now accepted in apr import, maps to Llama architecture
  • --arch falcon, --arch mamba, --arch t5 return clear "not yet supported" errors

CI / infra

  • sccache pilot (APR-MONO heavy workload — #894).
  • cargo nextest run opt-in (PMAT-155 — #897).

Changed

  • scripts/ship-two-001/ex-06-pull-and-rerun.sh harness v2 — relaxed AC-EX-006 verification to match spec §12.3 literal ("emits syntactically valid Python"). Prior harness required def fib to appear in the completion, which is stricter than the spec; Instruct models greedy-decoding a raw prompt don't reliably autocomplete (teacher's 84.76% HumanEval works via the eval harness's instruction wrapper, not raw completion). v2 finds the longest leading-line prefix that ast.parses and requires ≥ 1 non-trivial statement (regression-checked against garbage/empty/comment-only inputs). Pre-upload local dry-run PASSES.
  • GH-478: per-layer dequant for native Q4/Q8 tensorsapr run on native-quantized .apr files now dequantizes layer-at-a-time instead of up-front, reducing peak memory on large models. (#750)
  • Decode hot-path hygiene (HP-001 / HP-002 / HP-003) — removed per-token /tmp writes, realizar#198 diagnostic eprintlns, and PMAT-450 prefix-cache eprintlns from the GPU decode path. 1.5B Q4_K_M: 184 → 382 tok/s (2.07×). Short-prompt 32-tok bench: 442.8 → 479.9 tok/s.
  • F-FLASH-DECODE-REGRESSION-001: auto-disable split-K for small models — FlashDecoding was hurting 1.5B decode throughput; gated by model size. 383 → 412 tok/s median.
  • F-ATTN-MULTIWARP-WARPS-001: tuned num_warps_per_head — 4 warps/head is optimal for small-model decode (2-warp −1.3%, 1-warp −7%).
  • F-PROFILE-010: separate graphed throughput from ungraphed per-op hotspotsapr profile output now labels methodology; launch-overhead metric normalized per-token.
  • GH-378: Priority-queue BPE merge algorithm — Replaced O(n^2) greedy-rescan with priority-queue (BinaryHeap) + doubly-linked symbol list. 2.06x encode speedup (145us -> 70us on Qwen3 151K vocab). Beats HuggingFace tokenizers v0.22 reference (104us). Zero allocation in merge loop. All 117 BPE tests pass.
  • GH-378: Optimized tokenizer.json loading — Pre-sized HashMaps, moved vocab strings instead of cloning, eliminated 600K String/Vec allocations during merge loading. from_file 272ms -> 142ms (1.91x faster), now beats HuggingFace v0.22 by 1.43x. Applies to all tokenizer formats (Qwen2, Whisper, GPT-2, LLaMA) via shared load_from_json path.
  • apr finetune --task classify now auto-detects and corrects class imbalance (via entrenar auto-balancing).

Fixed

  • F2 cosine parity gate (PMAT-PARITY-GATE-V2) — CPU↔GPU parity now computed on logits cosine, not argmax-exact. Cuts false-positive parity failures from sampling-determinism drift.
  • F-PUBLISH-EXTRA-001::safetensors_dtype_fp16 — fp16 dispatch in apr export --format safetensors — the end-user apr_exportdispatch_exportExportFormat::SafeTensors path (format/converter/gguf_export_config.rs::export_safetensors_with_companions) was ignoring options.quantize and always writing F32, silently producing a 30.46 GiB file when --quantize fp16 was requested. Now routes through save_safetensors_quantized, producing the expected 14.19 GiB F16 artifact for Qwen2.5-Coder-7B. The unit-tested save_model_tensors path was correct but unreachable from apr_export — this was a missed wire between the two writers after they were split. Three ship manifests (-apr, -safetensors, -gguf) now validate PASS against apr validate-manifest.
  • Flaky perf teststui_load (warmup + best-of-3 — #878), F-203 SIMD timing (warmup + best-of-5 — #875), RP-002-prop fp32 tolerance widened (dim=8 noise floor — #879), citl-neural similarity tolerance (#828), zram-core F058 debug/CI budget 100µs → 500µs (#807).
  • aprender-train matmul #[should_panic] expected string (#862).

Falsified (documented, no code change)

  • F-RMSNORM-FUSION-001 on 1.5B — +0.55% (within noise) on 1.5B retest; 1-in-6 runs hit CUDA_ERROR_ILLEGAL_ADDRESS. FUSION-003 BLOCKED on both 7B (3× regress) and 1.5B (neutral). See contracts/kernel-fusion-v1.yaml v1.1.0.
  • F-ATTN-FLASHDECODE-2WARP-001 — trueno#253 2-warp chunk kernel lost 0.9%; wrapper overhead dominates, not chunk occupancy.
  • F-DECODE-GPU-RESIDENT-SAMPLING-001 — contract falsified; see contracts/gpu-resident-sampling-v1.yaml.
  • SHIP-TWO-001 MODEL-1 distilled v2 checkpointqwen2.5-coder-7b-distilled-v2-q4k.apr emits garbage ("ylkoylko..."); apr qa Golden Output FAIL despite Tensor Contract PASS. AC-SHIP1-005 falsified. v2.0.0 spec pivots to teacher-first ship.

MoE / PMAT-587 series

  • PMAT-587 Phase 2c integratedcuGraphExecKernelNodeSetParams wired into MoE decode hotpath.
  • PMAT-588 — event-based MoE stream sync (SHIPPED).
  • PMAT-589 — resolved apr trace --gpu dispatch regression (unblocked PMAT-587).
  • PMAT-592cuda_layer_ffn MoE detection guard.
  • PMAT-593apr run ChatML special-token regression fix.
  • apr trace --json now emits per-layer tensors[] + param_count.

Refactored

  • apr-cli::print_ollama_comparison CC 15 → ≤10 (#861); batch of 90 Gate 10 V4 CC>10 refactors (#860); aprender-qa-report::check_gateways CC 11 → ≤10 (#857); bug-log comments rewritten as invariants, High SATD 5 → 0 (#758).

Dependencies

  • 13,026 tests passing (aprender-core); 25,300+ across workspace.
  • All 78 workspace crates at v0.31.0.

[0.30.0] - 2026-04-12

Changed

  • Monorepo consolidation complete (APR-MONO)
  • All trueno, presentar, entrenar, realizar crates merged into aprender workspace
  • Coordinated PAIML Sovereign AI Stack release

[0.27.0] - 2026-02-26

Changed

  • Coordinated PAIML Sovereign AI Stack release
  • Updated trueno dependency from 0.15.0 to 0.16.0
  • 12,587 tests passing with 96.35% coverage

Dependencies

  • trueno 0.16.0 (SIMD compute backend)
  • realizar 0.8.0 (inference engine)
  • entrenar 0.7.2 (training library)
  • trueno-viz 0.2.1 (visualization)
  • apr-cli 0.4.4 (CLI tool)
  • renacer 0.10.0 (syscall tracer)

[0.25.0] - 2026-01-26

Added

QA Protocol Implementation (PMAT-098)

  • QA Matrix Runner (examples/qa_run.rs) - Comprehensive falsification suite

    • 21-cell test matrix: Modality (3) × Format (3) × Backend (2) + trace variants
    • Modalities: run, chat, serve
    • Formats: GGUF, SafeTensors, APR
    • Backends: CPU, GPU
    • Hang detection with 60s timeout (§7.6)
    • Garbage output detection (non-ASCII, repetition, mojibake patterns)
    • Word boundary validation for answer verification
    • Ollama parity comparison mode
  • QA Falsification Suite (examples/qa_falsify.rs) - Popperian falsification tests

    • Automated tests for hang detection, garbage detection, answer verification
    • Matrix integrity validation
    • SIGINT handler verification
    • Documents all falsification hypotheses and results
  • SIGINT Resiliency (PMAT-098-PF) - Zombie process mitigation

    • Global process registry with OnceLock<Arc<Mutex<Vec<u32>>>>
    • ProcessGuard RAII struct for automatic cleanup on Drop
    • Signal handler with Jidoka-style messaging
    • Prevents orphaned apr serve processes on Ctrl+C
    • Exit code 130 for proper SIGINT handling

CLI Flags for QA Matrix

# Run full 21-cell matrix
cargo run --example qa_run -- --full-matrix

# Single modality test
cargo run --example qa_run -- --modality serve --backend cpu --format gguf

# Compare against Ollama
cargo run --example qa_run -- --with-ollama

Changed

  • ctrlc crate added to dev-dependencies for signal handling
  • Documentation updated with QA protocol methodology

Fixed

  • Answer verification brittleness - Added contains_as_word() for word boundary checking
    • "four" no longer matches "fourteen"
  • Matrix documentation - Corrected from "27-test" to "21-cell"

Quality

  • All QA falsification tests passing
  • SIGINT handler verified with apr serve
  • Zero zombie processes after Ctrl+C

[0.24.1] - 2026-01-25

Changed

  • Updated HuggingFace URI resolution for auto-pull

[0.20.0] - 2025-12-22

Added

TensorLogic Neuro-Symbolic Reasoning (logic)

  • Logical Tensor Operations: logical_join, logical_project, logical_select
  • Einsum DSL: Direct mapping to tensor operations
  • Constraint Programming: ProgramBuilder for symbolic constraints
  • Embedding Integration: Similarity correlation with symbolic reasoning
  • Training Support: Negative sampling, curriculum learning, masked attention

QA Verification Modules (qa)

  • Security Module (qa/security): N1-N20 security verification (fuzzing, sanitizers, path traversal)
  • Documentation Module (qa/docs): O1-O20 documentation verification
  • Velocity Module (qa/velocity): P1-P10 test velocity verification
  • 210-point Popperian Falsification Checklist: Comprehensive verification framework

WASM/SIMD Browser Inference (wasm)

  • Browser-compatible INT4 quantization: Qwen2-0.5B-Instruct reference model
  • SIMD acceleration: 2x speedup vs scalar operations
  • Memory optimization: <512MB browser memory usage

End-to-End Demo Infrastructure (demo)

  • Qwen2Config: Browser inference configuration
  • DemoMetrics: Performance validation (load time, throughput, latency)
  • BrowserCompatibility: Chrome 120+, Firefox 120+, Safari 17+

Speech Processing (speech)

  • VAD (Voice Activity Detection): Energy-based speech segmentation
  • Audio Pipeline: Mel spectrogram, resampling, streaming

Examples

  • examples/whisper_transcribe.rs: End-to-end ASR pipeline demo
  • examples/qwen_chat.rs: Qwen2-0.5B configuration demo
  • examples/logic_family_tree.rs: TensorLogic family tree reasoning

Changed

  • Updated trueno dependency to 0.8.8 (compute integration)
  • Test velocity: Added make test-smoke (<2s), make test-heavy (slow tests)
  • Marked sleep()-using tests with #[ignore] for fast test path

Quality

  • 208/210 specification points verified (Grade: A+)
  • 4,819+ tests passing (unit + property + integration)
  • 96.94% code coverage (target: ≥95%)
  • All new features include Toyota Way documentation

[0.19.0] - 2025-12-21

Added

  • Audio module with mel spectrogram, resampling, streaming support
  • Speech VAD (Voice Activity Detection)

[0.18.2] - 2025-12-15

Changed

  • Updated trueno from v0.8.4 to v0.8.5 (simulation testing framework)

[0.16.0] - 2025-12-08

Added

Online Learning Module (online)

  • StreamingClassifier: Incremental learning for classification
  • StreamingRegressor: Incremental learning for regression
  • OnlineLearner trait: Unified interface for streaming ML

Model Inspection & Debugging (inspect)

  • ModelInspector: Introspect model architecture and weights
  • DiffViewer: Compare model versions and track changes
  • DebugSession: Interactive debugging for model behavior

Model Caching (cache)

  • ModelCache: LRU cache for loaded models
  • CachePolicy: Configurable eviction strategies
  • Reduces memory churn in production deployments

Embedding Module (embed)

  • TinyEmbed: Lightweight text embeddings for NLP
  • Quantized models for edge deployment

Model Scoring (scoring)

  • ModelScorer: Unified scoring interface
  • ScoringPipeline: Batch inference optimization

Loading Modes (loading)

  • LazyLoader: On-demand weight loading
  • StreamingLoader: Memory-efficient large model loading
  • MmapLoader: Memory-mapped model files

Sovereign Stack (stack)

  • SovereignStack: Full ML pipeline abstraction
  • Training, validation, and deployment in one interface

Model Zoo (zoo)

  • ModelRegistry: Browse and load pre-trained models
  • Integration with Hugging Face Hub

Benchmarking (bench)

  • ParetoFrontier: Multi-objective optimization analysis
  • Py2RsBenchmark: Compare Python vs Rust performance

Changed

  • Updated trueno dependency from 0.8.0 to 0.8.1

Quality

  • 3,782 tests passing
  • Comprehensive QA checklists added (100-point verification)
  • Toyota Way review documentation for new modules

[0.15.0] - 2025-12-07

Changed

  • Removed nalgebra dependency in favor of trueno 0.8.0 SymmetricEigen
  • All eigendecomposition now uses trueno's native implementation

[0.14.1] - 2025-12-06

Fixed

  • Minor bug fixes and stability improvements

[0.13.0] - 2025-11-29

Added

Metaheuristics - Constructive Algorithms

  • AntColony: Ant Colony Optimization for combinatorial problems (TSP, routing)
  • TabuSearch: Memory-based local search with aspiration criteria
  • ConstructiveMetaheuristic trait: Build solutions incrementally
  • NeighborhoodSearch trait: Local search with move evaluation
  • SearchSpace::Graph: Graph-based search spaces for routing problems

aprender-tsp Crate (v0.1.0)

  • TSP solver CLI with train/solve/benchmark/info commands
  • Multiple algorithms: ACO, Tabu Search, Genetic Algorithm, Hybrid
  • TSPLIB format support (.tsp files)
  • Model persistence with .apr binary format
  • Pre-trained POC models on Hugging Face: paiml/aprender-tsp-poc

Fixed

  • ATT (pseudo-Euclidean) distance formula in TSPLIB parser: sqrt((dx²+dy²)/10) not sqrt(dx²+dy²)/10

Documentation

  • Added ACO-TSP book chapter with aprender-tsp CLI usage
  • Updated README with Related Crates section (aprender-tsp, aprender-shell)
  • Added bashrs-style coverage guidance to CLAUDE.md

[0.12.0] - 2025-11-27

Major Release: Advanced Neural Networks & Program Repair

This release adds cutting-edge ML capabilities including Graph Neural Networks, RNN/LSTM/GRU, Variational Autoencoders, and a novel Compiler-in-the-Loop Learning system.

Added

Compiler-in-the-Loop Learning (citl module)

  • CITL: Neural-guided automated program repair
    • Transformer-based neural encoder for compiler diagnostics
    • Contrastive learning with InfoNCE loss
    • Pattern library with 21 Rust-specific fix templates
    • Iterative fix loop with confidence thresholds
    • GPU/CPU backend support via Trueno

Graph Neural Networks (gnn module)

  • GCN: Graph Convolutional Networks
  • GAT: Graph Attention Networks with multi-head attention
  • GraphSAGE: Inductive learning on large graphs
  • Message passing framework with customizable aggregation

Recurrent Neural Networks (nn/rnn module)

  • RNN: Vanilla recurrent networks
  • LSTM: Long Short-Term Memory with forget gates
  • GRU: Gated Recurrent Units
  • Bidirectional variants for all architectures

Variational Autoencoders (nn/vae module)

  • VAE: Standard variational autoencoder
  • BetaVAE: Disentangled representations with β parameter
  • ConditionalVAE: Class-conditional generation
  • Reparameterization trick for backpropagation

Model Interpretability (interpret module)

  • SHAP: SHapley Additive exPlanations
  • LIME: Local Interpretable Model-agnostic Explanations
  • Feature importance visualization
  • Partial dependence plots

Transfer Learning (transfer module)

  • Pre-trained model loading
  • Feature extraction mode
  • Fine-tuning with layer freezing
  • Domain adaptation utilities

Additional Features

  • Active Learning (active_learning): Uncertainty sampling, query-by-committee
  • Probability Calibration (calibration): Platt scaling, isotonic regression
  • Self-Supervised Learning (nn/self_supervised): Contrastive pretraining
  • Model Quantization (nn/quantization): INT8 quantization for inference
  • Text Generation (nn/generation): Autoregressive text generation

Quality Metrics

Test Count: 3,331 tests (unit + property + integration + doc) Test Coverage: 96.94% line coverage Clippy: 0 warnings in production code Zero Defects: Toyota Way compliance maintained

Documentation

  • Book chapters for all new modules
  • CITL automated repair case study
  • Examples for GNN, RNN, VAE usage

[0.8.0] - 2025-11-25

NEW FEATURE: Content-Based Recommendation System

This minor release adds a production-ready content-based recommendation system with HNSW indexing.

Added

Content-Based Recommender (recommend module)

  • ContentRecommender: Item-to-item similarity recommendations using TF-IDF + HNSW
    • O(log n) approximate nearest neighbor search
    • Automatic vocabulary growth handling with index rebuilding
    • Cosine similarity metric optimized for text
    • Example: Movie recommendations based on plot descriptions

HNSW Index (index module)

  • HNSWIndex: Hierarchical Navigable Small World graph for fast ANN search
    • Multi-layer probabilistic skip-list structure
    • O(log n) insertion and query complexity
    • Configurable M (connections) and ef_construction parameters
    • Cosine distance metric for text similarity

Incremental IDF Tracker (text module)

  • IncrementalIDF: Streaming IDF computation with exponential decay
    • Prevents IDF drift in streaming contexts
    • Decay factor 0.95 (half-life ~14 documents)
    • Formula: IDF = log((N + 1) / (df + 1)) + 1
    • Automatic vocabulary tracking

Changed

Dimensional Consistency Fix (Phase 2)

  • Automatic HNSW index rebuilding when vocabulary grows
  • Sorted vocabulary terms for consistent vector ordering
  • Re-vectorization of all items on vocabulary expansion
  • Eliminated -inf and NaN similarity scores

Quality Metrics

Test Coverage: 96.00% line coverage (maintained ≥95% requirement) Test Count: 1,293 tests (7 new recommender tests, 10 new property tests) Benchmarks: <100ms latency for 10,000 items (verified) Clippy: 0 warnings in new modules Zero Defects: Toyota Way compliance maintained

Documentation

  • Book Chapter: Comprehensive EXTREME TDD case study (book/src/examples/content-recommender.md)
  • Example: Movie recommendation demo (examples/recommend_content.rs)
  • Benchmark: Performance validation (benches/recommend.rs)

Files Added

  • src/index/mod.rs, src/index/hnsw.rs (504 lines)
  • src/text/incremental_idf.rs (276 lines)
  • src/recommend/mod.rs, src/recommend/content_based.rs (362 lines)
  • benches/recommend.rs (95 lines)
  • examples/recommend_content.rs (128 lines)

[0.7.1] - 2024-11-24

🔧 DEPENDENCY UPGRADE & QUALITY IMPROVEMENTS

This patch release upgrades the trueno dependency and improves documentation quality.

Changed

Dependencies

  • trueno: 0.6.0 → 0.7.1
    • Updated to latest trueno with wgpu 27, criterion 0.7, and other dependency updates
    • Full compatibility verified with all 1446 tests passing

Code Quality

  • Clippy compliance: Fixed 14 clippy warnings in src/optim/mod.rs
    • Replaced match with if let patterns (3 instances)
    • Implemented proper Default traits for BacktrackingLineSearch and WolfeLineSearch
    • Fixed snake_case naming for matrix variables
    • Added #[allow] attributes for acceptable long functions and many arguments
    • Replaced manual if-panic! with assert! macro

Documentation

  • Book additions: Added 4 comprehensive optimization example chapters
    • ADMM Optimization (Distributed ML + Federated Learning)
    • Batch Optimization (L-BFGS, CG, Damped Newton)
    • Convex Optimization (FISTA + Coordinate Descent)
    • Constrained Optimization (Projected GD + Augmented Lagrangian + Interior Point)
  • Doctest fixes: Fixed all 9 failing doctests for trueno 0.7.1 compatibility
    • Added missing Optimizer and LineSearch trait imports (6 fixes)
    • Corrected Vector import paths from trueno:: to aprender::primitives:: (3 fixes)
    • Relaxed numeric precision assertions to handle implementation variations

Quality Metrics

Test Coverage: 96.27% line coverage (exceeds ≥95% requirement) Test Count: 1446 tests (1165 unit + 36 integration + 36 property + 209 doc) Clippy: 0 warnings (strict mode: -D warnings) Zero Defects: Toyota Way compliance maintained

Migration

No breaking changes. Drop-in replacement for 0.7.0:

[dependencies]
aprender = "0.7.1"

All existing code continues to work without modification.

[0.7.0] - 2025-11-22

🎯 STATISTICAL RIGOR RELEASE - Negative Binomial GLM & IRLS Stabilization

This release demonstrates Toyota Way problem-solving methodology, applying 5 Whys root cause analysis to eliminate defects and implement peer-reviewed statistical solutions for overdispersed count data.

Added

GLM: Negative Binomial Family

  • Family::NegativeBinomial - Proper handling of overdispersed count data
    • Variance function: V(μ) = μ + α*μ² (α = dispersion parameter)
    • Canonical link: log (same as Poisson)
    • Gamma-Poisson mixture model interpretation
    • Builder method: with_dispersion(α) (default α = 1.0)
    • 3 comprehensive tests (basic, low dispersion, validation)

IRLS Algorithm Stabilization

  • Step damping for log link - Prevents divergence in IRLS
    • 0.5 step size for log link (all families)
    • Full step size for other links (inverse, logit, identity)
    • Fixes convergence for count data (Poisson, NegativeBinomial)
    • Also stabilizes Gamma with non-canonical log link

Changed

GLM Implementation

  • Root Cause Fix - Applied 5 Whys methodology:
    1. Why IRLS diverges? → Unstable weights
    2. Why unstable weights? → Extreme μ values
    3. Why extreme μ? → Data overdispersed
    4. Why overdispersion breaks Poisson? → Assumes mean=variance
    5. Solution: Use Negative Binomial for overdispersed data!
  • Updated Family::variance() to accept dispersion parameter
  • Updated module documentation with overdispersion guidance
  • Added reference to notes-poisson.md for peer-reviewed analysis

Documentation

notes-poisson.md

  • Comprehensive overdispersion analysis
  • 10 peer-reviewed references (Cameron & Trivedi, Hilbe, Gelman et al.)
  • Gamma-Poisson mixture explanation
  • Mathematical justification: V(Y) = E[Y] + α*(E[Y])²
  • Consequences of ignoring overdispersion (narrow posteriors, Type I errors)

Quality Metrics

Test Count: 1039 tests (1036 passing, 0 failing, 3 doc tests need import fixes) GLM Tests: 15/15 passing (added 3 NB tests) Coverage: 96.94% (maintained) Clippy: 0 warnings Zero Defects: Toyota Way compliance - no known issues shipped

References

  1. Cameron, A. C., & Trivedi, P. K. (2013). Regression Analysis of Count Data. Cambridge University Press.
  2. Hilbe, J. M. (2011). Negative Binomial Regression. Cambridge University Press.
  3. Gelman, A., et al. (2013). Bayesian Data Analysis, Third Edition. CRC Press.
  4. Gardner, W., et al. (1995). Regression analyses of counts and rates. Psychological Bulletin, 118(3), 392–404.
  5. Ver Hoef, J. M., & Boveng, P. L. (2007). Quasi-Poisson vs. negative binomial regression. Ecology, 88(11), 2766-2772.

Migration Guide

No breaking changes. Negative Binomial is additive:

use aprender::glm::{GLM, Family};
use aprender::primitives::{Matrix, Vector};

// Before: Poisson (assumes mean = variance)
let mut model = GLM::new(Family::Poisson);

// After: Negative Binomial (handles overdispersion)
let mut model = GLM::new(Family::NegativeBinomial)
    .with_dispersion(0.5); // Control overdispersion level

model.fit(&x, &y)?;
let predictions = model.predict(&x_test)?;

Toyota Way Principles Demonstrated

  • Genchi Genbutsu: Read peer-reviewed literature to understand root cause
  • 5 Whys: Traced IRLS divergence to overdispersion assumption violation
  • Jidoka: Automated quality gates prevented defective code from shipping
  • Kaizen: Continuous improvement - eliminated technical debt instead of documenting it

[0.6.0] - 2025-11-22

🚀 GRAPH ALGORITHMS COMPLETE - 26/26 ALGORITHMS (100%)

This major release completes all 26 graph algorithms from the specification, adding 11 new algorithms across pathfinding, components, traversal, community detection, and link prediction.

Added

Graph Algorithms - Phase 1: Pathfinding (4 algorithms)

  • shortest_path(source, target) - BFS-based unweighted shortest path

    • Time: O(n + m), Space: O(n)
    • Returns path as node sequence or None if disconnected
    • Benchmark: ~467ns (100 nodes), ~2.2µs (1000 nodes)
  • dijkstra(source, target) - Weighted shortest path with priority queue

    • Time: O((n + m) log n), Space: O(n)
    • Returns (path, distance) tuple
    • Panics on negative edge weights with descriptive error
    • Benchmark: ~850ns (100 nodes), ~8.5µs (1000 nodes)
  • a_star(source, target, heuristic) - Heuristic-guided pathfinding

    • Time: O((n + m) log n) with admissible heuristic
    • Takes closure for domain-specific heuristic
    • 1.1-1.2x faster than Dijkstra with good heuristics
    • Benchmark: ~750ns (100 nodes), ~7.2µs (1000 nodes)
  • all_pairs_shortest_paths() - Distance matrix computation

    • Time: O(n(n + m)), Space: O(n²)
    • Returns n×n matrix, None for disconnected pairs
    • Benchmark: ~19.6µs (50 nodes), ~117µs (200 nodes)

Graph Algorithms - Phase 2: Components & Traversal (4 algorithms)

  • dfs(source) - Depth-first search with stack

    • Time: O(n + m), Space: O(n)
    • Returns nodes in pre-order visitation
    • Stack-based (avoids recursion overflow)
    • Benchmark: ~580ns (100 nodes), ~28µs (5000 nodes)
  • connected_components() - Union-Find with path compression

    • Time: O(m α(n)), Space: O(n) where α = inverse Ackermann
    • Returns component ID for each node
    • Path compression + union by rank optimizations
    • Benchmark: ~1.2µs (100 nodes), ~58µs (5000 nodes)
  • strongly_connected_components() - Tarjan's algorithm (single DFS pass)

    • Time: O(n + m), Space: O(n)
    • Returns SCC ID for each node in directed graphs
    • Single-pass Tarjan's (faster than 2-pass Kosaraju's)
    • Benchmark: ~1.8µs (100 nodes), ~87µs (5000 nodes)
  • topological_sort() - DFS-based DAG ordering with cycle detection

    • Time: O(n + m), Space: O(n)
    • Returns Some(order) for DAGs, None for graphs with cycles
    • Early termination on cycle detection
    • Benchmark: ~620ns (100 nodes), ~6.2µs (1000 nodes)

Graph Algorithms - Phase 3: Community & Link Analysis (3 algorithms)

  • label_propagation(max_iter, seed) - Iterative community detection

    • Time: O(max_iter × (n + m)), Space: O(n)
    • Deterministic with seed parameter
    • Converges in 5-7 iterations typical
    • Benchmark: ~8.5µs (100 nodes), ~420µs (5000 nodes)
  • common_neighbors(u, v) - Link prediction metric

    • Time: O(min(deg(u), deg(v))), Space: O(1)
    • Two-pointer set intersection on sorted CSR arrays
    • Sub-microsecond performance
    • Benchmark: ~45ns (avg degree 10), ~350ns (avg degree 100)
  • adamic_adar_index(u, v) - Weighted link prediction

    • Time: O(min(deg(u), deg(v))), Space: O(1)
    • Formula: AA(u,v) = Σ 1/ln(deg(z)) for common neighbors z
    • Emphasizes rare connections over common hubs
    • Benchmark: ~65ns (avg degree 10), ~510ns (avg degree 100)

Documentation

  • Book Chapter: graph-pathfinding.md (427 lines)

    • Theory and implementation for all 4 pathfinding algorithms
    • Visual examples, complexity analysis, use cases
    • Comparison tables: BFS vs Dijkstra vs A*
    • Academic references (Dijkstra 1959, Hart et al. 1968)
  • Book Chapter: graph-components-traversal.md (564 lines)

    • DFS: Stack-based traversal with visual examples
    • Connected Components: Union-Find with path compression
    • SCCs: Tarjan's algorithm with disc/low-link explanation
    • Topological Sort: Cycle detection and DAG ordering
    • Performance benchmarks and advanced topics
  • Book Chapter: graph-link-prediction.md (445 lines)

    • Common Neighbors: Two-pointer algorithm explanation
    • Adamic-Adar: Weighted similarity with rarity emphasis
    • Label Propagation: Iterative community detection
    • Comparison tables and evaluation metrics
  • Example: graph_algorithms_comprehensive.rs (385 lines)

    • Demonstrates all 11 new algorithms from Phases 1-3
    • Real-world scenarios: road networks, task scheduling, social networks
    • Visual ASCII diagrams and detailed output
    • Educational value with step-by-step interpretation
  • Performance Documentation: graph-algorithms-performance.md (392 lines)

    • Comprehensive benchmarks for all 26 algorithms
    • Scalability analysis by complexity class
    • Comparison with petgraph and NetworkX
    • Optimization opportunities and production recommendations
  • Specification Update: complete-graph-methods-statistics-spec.md

    • Updated from 15/26 (58%) to 26/26 (100%) complete
    • Marked all Phases 1-3 as completed
    • Added implementation summaries for v0.5.1

Benchmarks

  • benches/graph.rs - Comprehensive benchmark suite (433 lines)
    • 17 benchmark functions covering all algorithm categories
    • Parametric sizing: 50-5000 nodes depending on complexity
    • Deterministic random graph generation (LCG-based)
    • Criterion integration for statistical analysis

Changed

Graph Module

  • Specification compliance: 26/26 algorithms (100% of spec)
  • Total algorithms: 26 (7 centrality + 4 pathfinding + 3 traversal + 7 structural + 3 community + 2 link)
  • New tests: 120 comprehensive tests (54 + 40 + 26 from Phases 1-3)
  • Total tests: 900+ tests (all passing)

Performance

  • Linear algorithms: <100µs for 5000 nodes (DFS, components, degree centrality)
  • Log-linear algorithms: <10µs for 1000 nodes (Dijkstra, A*)
  • Quadratic algorithms: <30ms for 200 nodes (betweenness, diameter)
  • Link prediction: <500ns (sub-microsecond) for typical graphs
  • Perfect linear scaling: Verified for all O(n+m) algorithms

Quality Metrics

Test Count: 900+ tests (120 new graph algorithm tests) Coverage: 96.94% line, 95.46% region, 96.62% function Clippy Warnings: 0 (lib target) GH-41 Compliance: 0 unwrap() calls in src/ (100% .expect() with messages) Mutation Score: 85.3% (target: ≥85%)

Documentation Summary

  • 4 comprehensive book chapters (pathfinding, components, link prediction, performance)
  • 2 examples (social network, comprehensive algorithms demo)
  • 1 benchmark suite (17 functions, all algorithms)
  • 1 performance analysis document (392 lines)
  • 1 specification (updated to 100% complete)

Total documentation: ~2,400 lines of theory, examples, and benchmarks

Migration Guide

No breaking changes. All new functionality is additive:

use aprender::graph::Graph;

// Pathfinding
let g = Graph::from_weighted_edges(&[(0,1,1.0), (1,2,2.0)], false);
let (path, dist) = g.dijkstra(0, 2).expect("path exists");

// Components
let components = g.connected_components();
let sccs = g.strongly_connected_components();

// Traversal
let order = g.dfs(0).expect("node exists");
let topo = g.topological_sort(); // Some(order) or None (cycle)

// Link Prediction
let cn = g.common_neighbors(0, 1).expect("nodes exist");
let aa = g.adamic_adar_index(0, 1).expect("nodes exist");

// Community Detection
let communities = g.label_propagation(10, Some(42));

References

  1. Dijkstra, E. W. (1959). "A note on two problems in connexion with graphs."
  2. Hart, P. E., et al. (1968). "A formal basis for heuristic determination of minimum cost paths."
  3. Tarjan, R. E. (1972). "Depth-first search and linear graph algorithms."
  4. Tarjan, R. E. (1975). "Efficiency of a good but not linear set union algorithm."
  5. Raghavan, U. N., et al. (2007). "Near linear time algorithm to detect community structures."
  6. Adamic, L. A., & Adar, E. (2003). "Friends and neighbors on the Web."

[0.5.1] - 2025-11-21

Fixed

Code Quality Improvements (GH-41 Completion)

  • Completed .unwrap() to .expect() migration across entire codebase
    • Examples: 26 files, 260+ replacements → "Example data should be valid"
    • Benchmarks: 3 files, all .unwrap() calls fixed → "Benchmark data should be valid"
    • Tests: 12 files, 400+ replacements → "Test data should be valid"
    • Result: Zero clippy::disallowed_methods warnings for .unwrap()
    • Clippy warnings reduced from 801 → 89 (89% improvement)

Style & Formatting

  • Auto-fixed format string warnings
    • Applied clippy --fix for uninlined-format-args
    • Fixed 29 format string warnings across examples/benches/tests
    • Applied cargo fmt for consistent formatting

Infrastructure

Workflow Verification (GH-43)

  • Verified benchmark CI workflow complete
    • Manual trigger (workflow_dispatch) with optional reason
    • PR trigger for performance-sensitive file changes
    • Weekly scheduled runs (Sunday 2 AM UTC)
    • Artifact uploads (criterion results: 90-day, output: 30-day)
    • PR comments with benchmark summaries
    • Actively running on recent Dependabot PRs

In Progress

Dependency Updates

  • 5 GitHub Actions Dependabot PRs rebased and in CI (#46-50):
    • peaceiris/actions-gh-pages 3→4
    • actions/upload-artifact 4→5
    • codecov/codecov-action 4→5
    • actions/checkout 4→6
    • actions/github-script 7→8
  • 4 Cargo dependency PRs require API migration review (#51-54):
    • nalgebra 0.33→0.34 (PCA dependency)
    • criterion 0.5→0.7 (dev dependency)
    • rand 0.8→0.9 (model_selection dependency)
    • bincode 1.3→2.0 (serialization - breaking changes)

Quality Metrics

Test Count: 742 tests (all passing) Clippy Warnings: 801 → 89 (89% improvement, 712 fixed) Production Code: 100% clippy-clean Coverage: 96.94% (maintained)

[0.4.2] - 2025-11-21

🎯 TESTING EXCELLENCE & DEPENDENCY UPDATE RELEASE

This release achieves 96.94% code coverage, integrates mutation testing, implements workspace-level lints, and upgrades core dependencies.

Changed

Dependencies

  • Upgraded trueno to v0.6.0 (from v0.4.1)
    • Enhanced SIMD optimizations and performance improvements
    • Improved floating-point precision handling
    • Updated test tolerances to accommodate SIMD precision differences
  • Upgraded renacer to v0.6.1 (from v0.5.1, dev dependency)
    • Latest profiling and chaos engineering features

Lint Configuration (GH-42)

  • Converted to workspace-level lints in Cargo.toml
    • Added [workspace] section with members = ["."]
    • Moved all lints to [workspace.lints.rust] and [workspace.lints.clippy]
    • Package inherits via [lints] workspace = true
    • Prepares for future multi-crate workspace
    • Improves PMAT Code Quality score

Added

Testing Infrastructure (GH-55)

  • Achieved 96.94% code coverage (target: ≥95%)

    • 95.46% region coverage, 96.62% function coverage
    • All major modules >92% coverage
    • 3 modules at 100%: optim, loss, graph
    • HTML reports: target/coverage/html/html/index.html
    • LCOV data for CI integration
  • Coverage CI Integration

    • Automated coverage reports on every PR
    • Codecov integration with PR comments
    • Updated targets: 95% project, 90% patch
  • Mutation Testing Integration

    • cargo-mutants v25.3.1 configured
    • CI integration (~13,705 mutants)
    • Results uploaded as artifacts (30-day retention)
    • Target: ≥80% mutation score
    • Configuration: .cargo-mutants.toml
  • Documentation

    • coverage-analysis.md - Detailed coverage breakdown
    • mutation-testing-setup.md - Comprehensive mutation testing guide
    • CLAUDE.md updated with coverage and mutation testing sections

Fixed

Test Compatibility

  • Relaxed test tolerances for trueno v0.6.0 compatibility
    • test_random_forest_classifier_feature_importances_reproducibility: Increased tolerance from 0.1 to 0.15 for SIMD precision differences
    • test_forest_different_n_estimators: Changed from exact match to 75% match threshold for predictions after serialization roundtrip
    • All 742 tests passing with new trueno version

Quality Metrics

Test Count: 742 tests (unit + property + integration + doc) Coverage: 96.94% line, 95.46% region, 96.62% function Rust Project Score: Improved Testing Excellence category PMAT Score: Code Quality improvements via workspace lints

[0.4.1] - 2025-11-21

🎯 QUALITY & INFRASTRUCTURE HARDENING RELEASE

This release focuses on eliminating technical debt, improving code quality, and establishing robust CI/CD infrastructure for long-term maintainability.

Changed

Dependencies

  • Upgraded trueno to v0.4.1 (from v0.2.2)
    • AVX-512 backend support (11-12x speedup for compute-bound operations on supported CPUs)
    • New vector operations: norm_l2(), norm_l1(), norm_linf(), scale(), abs(), clamp(), lerp(), fma()
    • Neural network activation functions: relu(), sigmoid(), gelu(), swish(), tanh(), exp()
    • Refactored multi-backend dispatch with macros (reduces ~1000 lines of code)
    • 100% functional equivalence maintained (all 827 trueno tests passing)
    • Critical bugfix: Missing abs() implementation in trueno v0.2.2 (Issue trueno#2)

Fixed

Critical Stability Improvements (Issue #41)

  • Eliminated ALL 1,066 unwrap() calls in production code
    • Replaced with .expect() with descriptive error messages
    • Prevents Cloudflare-class production panics (reference: 2025-11-18 outage)
    • Created .clippy.toml to enforce zero-unwrap policy via disallowed-methods
    • Known Defects score: 100% (was 0%)

Code Quality (Issue #44)

  • Fixed ~140 clippy pedantic warnings in library code
    • Auto-fixed 119 warnings: format strings, unnecessary qualifications, Debug derives
    • Manually fixed 21 warnings: needless continue, trivial casts, unused-self
    • Library code now clippy-clean (1 benign config warning only)
    • More idiomatic Rust patterns (let...else, better error handling)

Test Reliability

  • Fixed 3 flaky random forest tests with deterministic random states
  • Relaxed floating-point comparison tolerances where appropriate
  • All 742 tests now pass consistently

Added

CI/CD Infrastructure (Issue #45)

  • security.yml workflow - Three-tier dependency security scanning:

    • cargo-audit: CVE vulnerability detection
    • cargo-deny: License and policy enforcement via deny.toml
    • cargo-outdated: Proactive dependency tracking
    • Runs weekly (Mondays 3 AM UTC), on PR (dependency changes), and manual trigger
  • dependabot.yml - Automated dependency updates:

    • Rust dependencies: Weekly updates with intelligent grouping
    • GitHub Actions: Monthly updates
    • Auto-labeling and maintainer assignment
  • benchmark.yml workflow (Issue #43):

    • Runs criterion benchmarks on PR, weekly, and manual trigger
    • 90-day artifact retention for performance trend tracking
    • PR comments with benchmark results

Linting Configuration (Issue #42)

  • Comprehensive [lints.rust] and [lints.clippy] in Cargo.toml
  • Enforces: unsafe_code=forbid, pedantic level, checked conversions
  • ML-specific allows for float comparisons and mathematical notation
  • Consistent linting across entire workspace

Documentation

  • Updated CLAUDE.md with comprehensive CI/CD workflow documentation
  • Added local command references for security tools
  • Documented linting standards and best practices
  • Improved inline documentation throughout codebase

Quality Metrics

  • Tests: All 742 tests passing consistently
  • Coverage: Maintained high coverage with property-based testing
  • Clippy: Library code clean (pedantic level)
  • Known Defects: 100% (zero unwrap() calls)
  • Rust Tooling Score: Improved from 37.3% with new CI workflows

Notes

This release significantly improves code quality, stability, and automation infrastructure. No breaking API changes - fully backward compatible with v0.4.0. The elimination of unwrap() calls prevents an entire class of production panics, while new CI workflows provide continuous security monitoring and automated dependency management.

[0.4.0] - 2025-11-19

🎉 MAJOR MILESTONE: TOP 10 ML ALGORITHMS - 100% COMPLETE!

This release completes all 10 of the most popular machine learning algorithms used in industry, achieving full coverage of the Analytics Vidhya 2025 TOP 10 list.

Added

K-Nearest Neighbors (kNN) - Issue #23

  • KNearestNeighbors classifier with lazy learning
    • Distance metrics: Euclidean, Manhattan, Minkowski(p)
    • Weighted and uniform voting strategies
    • predict() and predict_proba() methods
    • Builder pattern: with_metric(), with_weights()
    • 17 comprehensive tests
    • Example: examples/knn_iris.rs (90% accuracy)
    • Theory: book/src/ml-fundamentals/knn.md
    • Case study: book/src/examples/knn-iris.md

Gaussian Naive Bayes - Issue #25

  • GaussianNB probabilistic classifier
    • Bayes' theorem with Gaussian likelihood
    • Log probabilities for numerical stability
    • Variance smoothing parameter (default 1e-9)
    • Class priors computed from training data
    • 16 comprehensive tests
    • Example: examples/naive_bayes_iris.rs (100% accuracy - outperforms kNN!)
    • Theory: book/src/ml-fundamentals/naive-bayes.md
    • Case study: book/src/examples/naive-bayes-iris.md

Linear Support Vector Machine (SVM) - Issue #24

  • LinearSVM maximum-margin classifier
    • Subgradient descent with hinge loss
    • C parameter for regularization control
    • Learning rate decay for convergence
    • decision_function() returns margin-based scores
    • Builder pattern: with_c(), with_learning_rate(), with_max_iter(), with_tolerance()
    • 14 comprehensive tests
    • Example: examples/svm_iris.rs (100% accuracy on binary classification)
    • Theory: book/src/ml-fundamentals/svm.md
    • Case study: book/src/examples/svm-iris.md

Gradient Boosting Machine (GBM) - Issue #26

  • GradientBoostingClassifier sequential ensemble
    • Gradient descent in function space
    • Fits trees to negative gradients (residuals)
    • Hyperparameters: n_estimators, learning_rate, max_depth
    • Uses DecisionTreeClassifier as weak learners
    • Log-odds initialization, sigmoid probability conversion
    • Early stopping when tree fitting fails
    • 13 comprehensive tests
    • Example: examples/gbm_iris.rs (demonstrates hyperparameter effects)
    • Case study: book/src/examples/gbm-iris.md

Principal Component Analysis (PCA)

  • PCA dimensionality reduction via eigendecomposition
    • Computes principal components from covariance matrix
    • explained_variance_ratio() for variance analysis
    • transform() projects data to lower dimensions
    • Builder pattern: with_n_components()
    • 13 comprehensive tests
    • Example: examples/pca_iris.rs (4D → 2D visualization)
    • Theory: book/src/ml-fundamentals/pca.md
    • Case study: book/src/examples/pca-iris.md

Documentation

  • Updated SUMMARY.md with all new theory and case study chapters
  • Updated tree/mod.rs documentation to mention ensemble methods
  • Updated classification/mod.rs to include kNN, Naive Bayes, and Linear SVM

Test Coverage

  • Total tests: 541 (up from 515)
  • New tests: 26 (13 GBM + 13 other algorithms)
  • All tests pass: ✅
  • Zero clippy warnings: ✅
  • Code formatting: ✅ rustfmt compliant

Quality Assurance

  • All examples run successfully
  • Comprehensive error handling (untrained models, dimension mismatches, empty data)
  • Builder patterns for ergonomic API
  • Probabilistic predictions where applicable (predict_proba)

TOP 10 Algorithms - Complete List

  1. Linear Regression (v0.1.0)
  2. Logistic Regression (v0.2.0)
  3. Decision Tree (v0.2.0)
  4. Random Forest (v0.2.0)
  5. K-Means (v0.1.0)
  6. PCA (v0.4.0) - NEW
  7. K-Nearest Neighbors (v0.4.0) - NEW
  8. Naive Bayes (v0.4.0) - NEW
  9. Support Vector Machine (v0.4.0) - NEW
  10. Gradient Boosting (v0.4.0) - NEW

All industry-standard ML algorithms are now available in aprender!

[0.3.1] - 2025-11-19

Added

SafeTensors Model Serialization - Complete Coverage (Issue #8)

All 7 remaining models now support SafeTensors format:

  • Ridge (linear_model)

    • Ridge::save_safetensors() / Ridge::load_safetensors()
    • Serializes: coefficients, intercept, alpha hyperparameter
    • 11 comprehensive tests (roundtrip, metadata, multiple cycles, R² preservation)
  • Lasso (linear_model)

    • Lasso::save_safetensors() / Lasso::load_safetensors()
    • Serializes: coefficients, intercept, alpha, max_iter, tol
    • 12 comprehensive tests including sparsity preservation
    • Validates L1 regularization produces zero coefficients
  • ElasticNet (linear_model)

    • ElasticNet::save_safetensors() / ElasticNet::load_safetensors()
    • Serializes: coefficients, intercept, alpha, l1_ratio, max_iter, tol
    • 12 comprehensive tests including L1/L2 mix validation
    • Tests l1_ratio extremes (0.0=Ridge, 0.5=balanced, 1.0=Lasso)
  • DecisionTreeClassifier (tree)

    • DecisionTreeClassifier::save_safetensors() / DecisionTreeClassifier::load_safetensors()
    • Serializes: Tree structure flattened to 6 parallel arrays via pre-order traversal
    • Arrays: node_features, node_thresholds, node_classes, node_samples, node_left_child, node_right_child
    • 11 comprehensive tests including deep trees (10+ levels), single leaf edge case
    • Preserves exact tree structure and decision boundaries
  • RandomForestClassifier (tree)

    • RandomForestClassifier::save_safetensors() / RandomForestClassifier::load_safetensors()
    • Serializes: Multiple trees with index prefixes (tree_0_, tree_1_, etc.)
    • Each tree: 7 tensors (6 structure arrays + max_depth)
    • Hyperparameters: n_estimators, max_depth, random_state
    • 12 comprehensive tests including large ensembles (20 trees)
    • Preserves voting behavior through exact tree reconstruction
  • KMeans (cluster)

    • KMeans::save_safetensors() / KMeans::load_safetensors()
    • Serializes: Centroids matrix (k × d), hyperparameters (n_clusters, max_iter, tol, random_state)
    • Metadata: inertia (within-cluster sum of squares), n_iter
    • 13 comprehensive tests including high-dimensional data (5 features)
    • Preserves exact centroid positions for reproducible cluster assignments
  • StandardScaler (preprocessing)

    • StandardScaler::save_safetensors() / StandardScaler::load_safetensors()
    • Serializes: Mean vector, std vector, with_mean flag, with_std flag
    • 14 comprehensive tests including inverse transform preservation
    • Tests all configurations (center only, scale only, both, neither/identity)
    • Preserves exact scaling parameters for reproducible transformations

Key Technical Achievements:

  • Tree serialization via pre-order traversal (eliminates recursion in storage)
  • Shared helper functions (flatten_tree_node, reconstruct_tree_node) for code reuse
  • Ensemble serialization with index prefixes for multiple models
  • Matrix serialization with shape metadata for multi-dimensional data
  • Boolean flags encoded as floats (1.0/0.0) for SafeTensors compatibility

Test Coverage:

  • Total: +85 SafeTensors tests across 7 models
  • All tests passing (100% success rate)
  • Property tests: idempotency, preservation of scores/predictions/inertia
  • Edge cases: unfitted models, corrupted files, nonexistent files

Cross-Platform Compatibility:

  • Compatible with HuggingFace ecosystem
  • Compatible with PyTorch, TensorFlow via SafeTensors
  • Compatible with realizar inference engine
  • Enables Rust → Python, Python → Rust model deployment
  • Eliminates pickle security vulnerabilities

[0.3.0] - 2025-11-19

Added

Model Serialization

  • SafeTensors Format Support - LogisticRegression (Issue #6)

    • LogisticRegression::save_safetensors() - Export binary classification models to SafeTensors format
    • LogisticRegression::load_safetensors() - Load models from SafeTensors format
    • Compatible with HuggingFace ecosystem, Ollama, PyTorch, TensorFlow
    • Compatible with realizar inference engine
    • Deterministic serialization (sorted keys for reproducibility)
    • 5 comprehensive tests (unfitted model, roundtrip, corrupted file, missing file, probability preservation)
    • Full documentation with rustdoc examples
    • Serializes coefficients + intercept tensors
    • Probability predictions preserved exactly after save/load roundtrip
  • SafeTensors Format Support - LinearRegression (Issue #5)

    • LinearRegression::save_safetensors() - Export models to SafeTensors format
    • LinearRegression::load_safetensors() - Load models from SafeTensors format
    • Compatible with HuggingFace ecosystem, Ollama, PyTorch, TensorFlow
    • Compatible with realizar inference engine
    • Deterministic serialization (sorted keys for reproducibility)
    • Comprehensive error handling (missing files, corrupted headers)
    • 8-byte header + JSON metadata + F32 tensor data (little-endian)
    • 7 integration tests covering roundtrip, validation, and error cases
    • Full documentation with usage examples

Changed

  • Dependencies: Added serde_json = "1.0" for SafeTensors metadata parsing
  • Test count: +12 SafeTensors tests (5 LogisticRegression + 7 LinearRegression, total: 417 lib tests)

0.2.0 - 2024-11-18

Added

Decision Tree & Random Forest

  • DecisionTreeClassifier - GINI-based decision tree classifier
    • Configurable max_depth parameter
    • Recursive tree building algorithm
    • Support for multi-class classification
    • Implements Estimator trait
  • RandomForestClassifier - Bootstrap aggregating ensemble
    • Configurable n_estimators (number of trees)
    • Bootstrap sampling with replacement
    • Majority voting for predictions
    • Reproducible results with random_state
    • Builder pattern: with_max_depth(), with_random_state()

Cross-Validation & Model Selection

  • train_test_split() - Random train/test splitting
    • Configurable test_size (0.0 to 1.0)
    • Optional random_state for reproducibility
    • Shuffles data before splitting
  • KFold - K-fold cross-validator
    • Configurable number of splits
    • Optional shuffling with with_shuffle()
    • Reproducible with with_random_state()
    • Handles uneven splits (distributes remainder across first folds)
  • cross_validate() - Automated cross-validation
    • Works with any Estimator implementation
    • Returns CrossValidationResult with statistics
    • Methods: mean(), std(), min(), max()

Model Persistence

  • Model Serialization - Save/load models to disk
    • Serde + bincode binary serialization
    • Works with all models: LinearRegression, KMeans, DecisionTree, RandomForest
    • Simple save() and load() API
    • Example: examples/model_persistence.rs

Examples

  • decision_tree_iris.rs - Decision tree classification demo
  • random_forest_iris.rs - Random Forest ensemble demo (20 trees, 100% accuracy)
  • cross_validation.rs - Complete CV workflow (train/test split, KFold, automated CV)
  • model_persistence.rs - Model save/load demonstration

Documentation

  • EXTREME TDD Book - Comprehensive methodology guide
    • 90+ chapter structure deployed to GitHub Pages
    • Live at: https://paiml.github.io/aprender/
    • Complete case study: Cross-Validation implementation
    • RED-GREEN-REFACTOR cycle documentation
    • Toyota Way principles (Kaizen, Jidoka, PDCA)
    • Anti-hallucination enforcement (all examples test-backed)

Changed

  • Dependencies:
    • Added rand = "0.8" for random sampling
    • Upgraded to trueno v0.2.2 - SIMD-accelerated tensor operations
      • Replaces internal Vector/Matrix with optimized trueno implementation
      • SIMD abs() performance improvements
      • All 184 tests passing with trueno backend
  • Total test count: 184 (+64 from v0.1.0)
  • Property tests: 22 (+3)
  • Doc tests: 16 (+3)

Fixed

  • LinearRegression: Clear error message for underdetermined systems (Issue #4)
    • Now returns "Cannot solve: system is underdetermined (more features than samples)"
    • Previously threw cryptic Cholesky decomposition errors

0.1.0 - 2024-11-18

Added

Core Primitives

  • Vector<f32> - 1D numerical array with operations:
    • Statistical: sum, mean, variance, argmin, argmax
    • Algebraic: dot, norm, add, sub, mul
  • Matrix<f32> - 2D numerical array with operations:
    • Linear algebra: matmul, matvec, transpose
    • Solvers: cholesky_solve for normal equations
  • DataFrame - Named column container:
    • Column access: column(), select()
    • Row access: row()
    • Conversion: to_matrix()
    • Statistics: describe()

Machine Learning Models

  • LinearRegression - Ordinary Least Squares via normal equations
    • Implements Estimator trait (fit, predict, score)
    • Returns coefficients and intercept
    • R² score for model evaluation
  • KMeans - K-means++ initialization with Lloyd's algorithm
    • Implements UnsupervisedEstimator trait
    • Configurable: with_max_iter(), with_tol(), with_random_state()
    • Returns labels, centroids, inertia, iteration count

Metrics

  • Regression: r_squared, mse, rmse, mae
  • Clustering: silhouette_score, inertia

Traits

  • Estimator<X, Y> - Supervised learning interface
  • UnsupervisedEstimator<X> - Unsupervised learning interface
  • Transformer<X> - Data transformation interface

Testing

  • 120 unit tests covering all modules
  • 19 property-based tests (proptest)
  • 13 documentation tests
  • Edge case coverage for numerical stability

Examples

  • boston_housing.rs - Linear regression demo
  • iris_clustering.rs - K-Means clustering demo
  • dataframe_basics.rs - DataFrame operations demo

Benchmarks

  • linear_regression.rs - Fit/predict performance
  • kmeans.rs - Clustering performance

Documentation

  • Complete rustdoc for public API
  • README with quick start examples
  • ROADMAP with version planning
  • CHANGELOG (this file)

Quality Metrics

  • TDG Score: 95.6/100 (A+ grade)
  • Repository Score: 95.0/100 (A+)
  • Test Coverage: 97.72%
  • Mutation Score: 85.3%
  • Max Cyclomatic Complexity: 5 (target ≤10)
  • Max Cognitive Complexity: 8 (target ≤15)
  • Clippy: Zero warnings
  • SATD: Zero TODO/FIXME comments

Technical Details

  • Pure Rust implementation (no external ML dependencies)
  • f32 precision for all numerical operations
  • Cholesky decomposition for solving normal equations
  • K-means++ for intelligent centroid initialization

Release Notes

v0.1.0

First release of Aprender, providing a minimal viable foundation for machine learning in Rust. This release focuses on two core algorithms (Linear Regression and K-Means) implemented with comprehensive testing following EXTREME TDD methodology.

Highlights:

  • Production-ready OLS linear regression
  • Efficient K-means clustering with k-means++ initialization
  • Clean, sklearn-inspired API via traits
  • Extensive test coverage (120+ tests)
  • High quality score (TDG 94.1/100)

Known Limitations:

  • f32 only (no f64 support yet)
  • No GPU acceleration (planned for v1.0)
  • No model serialization (planned for v1.0)
  • No train/test split utility (planned for v0.2)

Release Notes

v0.2.0

Major feature release adding tree-based models, ensemble methods, cross-validation, and model persistence.

Highlights:

  • Decision Tree and Random Forest classifiers
  • Complete cross-validation utilities (train/test split, KFold, automated CV)
  • Model serialization for all models
  • EXTREME TDD Book with comprehensive methodology guide
  • 64 new tests (+54% increase)

Breaking Changes: None (backward compatible)

Migration Guide: No migration needed. All v0.1.0 APIs remain unchanged.


  • Implement Content-Based Recommender with HNSW (Phase 1) (#71)
  • PMAT-114: SafeTensors→APR inference fix
  • PMAT-114: SafeTensors→APR inference fix
  • GH-205: F16 SafeTensors Passthrough Fix