feat: End-to-end training pipeline with RuVector signal intelligence #49

Merged
ruvnet merged 7 commits from feat/windows-wifi-enhanced-fidelity into main 2026-03-01 13:10:26 +08:00
ruvnet commented 2026-03-01 12:59:37 +08:00 (Migrated from github.com)

Summary

  • Wire up end-to-end training pipeline (Issue #44): Connect graph transformer, trainer, dataset, and sparse inference into a working --train--model flow
  • Weight serialization: flatten_weights()/unflatten_weights() on CsiToPoseTransformer for checkpoint and RVF save/load roundtrip
  • Trainer↔Transformer bridge: from_dataset_sample() conversion, Trainer::with_transformer() constructor delegates predict_keypoints to CsiToPoseTransformer::forward()
  • Real INT8 quantization: apply_quantization() now quantizes per-layer weights and uses dequantize-on-the-fly during forward pass
  • CLI training mode: --train --dataset PATH --epochs N --save-rvf model.rvf runs full training, saves best-epoch weights to RVF container
  • Best-epoch snapshotting: Trainer saves best validation loss weights and restores them before checkpoint/export
  • Performance fix: CsiToPoseTransformer::zeros() skips Xavier init for gradient estimation (avoids ~44K wasted constructions per batch)
  • ADR-021: Vital sign detection + RVF container format (closes #45)
  • ADR-022: Windows WiFi enhanced fidelity with multi-BSSID pipeline
  • ADR-023: Full DensePose training pipeline (Phases 1-8)
  • Docker: Reorganized into docker/ directory with multi-stage Rust and Python images

New Crates

Crate Lines Description
wifi-densepose-vitals 1,863 Breathing/HR detection, anomaly scoring, RVF storage
wifi-densepose-wifiscan 4,829 Multi-BSSID scanning, netsh/WlanAPI adapters, 8-stage pipeline

New Modules (sensing-server)

Module Lines Description
graph_transformer.rs 855 Cross-attention + GNN transformer with weight serialization
trainer.rs 881 6-term loss, SGD+momentum, cosine LR, early stopping, checkpoints
dataset.rs 850 MM-Fi + Wi-Pose loaders, windowing, normalization
sparse_inference.rs 753 Neuron profiling, sparse forward, INT8/FP16 quantization
sona.rs 639 LoRA adapters, EWC++ memory, environment profiles
rvf_container.rs 914 Binary container format (manifest, weights, SONA, vitals)
rvf_pipeline.rs 1,027 Progressive loading, HNSW index, overlay graph
vital_signs.rs 774 Bandpass + FFT breathing/HR detection

Test Results

  • 239 tests passing (157 lib + 48 RVF + 16 container + 18 vitals)
  • Zero compilation errors
  • 10 new integration tests for weight roundtrip, trainer+transformer, quantization accuracy

Docker

No Dockerfile changes required — the existing docker/Dockerfile.rust builds the same binary with new CLI flags automatically. Docker Hub images can be rebuilt at next release.

Known Limitations (noted by review, not blocking)

  • Asymmetric quantization zero_point stored as i8 (pre-existing, only affects Int8Asymmetric mode which is not the default)
  • Body part / UV loss terms use placeholder logic when transformer is active (scheduled for Phase 9)
  • graph_edge_loss not computed in training loop (loss weight has no effect)

Test plan

  • cargo check -p wifi-densepose-sensing-server — compiles cleanly
  • cargo test -p wifi-densepose-sensing-server — 239 tests pass
  • Weight roundtrip: flatten_weights()unflatten_weights() produces identical forward output
  • Quantized forward within 5% MSE of f32 forward
  • Trainer with transformer produces finite loss across epochs
  • Best-epoch params restored after run_training()
  • cargo run -- --train --epochs 5 --save-rvf test.rvf (manual)
  • cargo run -- --model test.rvf --source simulate (manual)

🤖 Generated with claude-flow

## Summary - **Wire up end-to-end training pipeline** (Issue #44): Connect graph transformer, trainer, dataset, and sparse inference into a working `--train` → `--model` flow - **Weight serialization**: `flatten_weights()`/`unflatten_weights()` on `CsiToPoseTransformer` for checkpoint and RVF save/load roundtrip - **Trainer↔Transformer bridge**: `from_dataset_sample()` conversion, `Trainer::with_transformer()` constructor delegates `predict_keypoints` to `CsiToPoseTransformer::forward()` - **Real INT8 quantization**: `apply_quantization()` now quantizes per-layer weights and uses dequantize-on-the-fly during forward pass - **CLI training mode**: `--train --dataset PATH --epochs N --save-rvf model.rvf` runs full training, saves best-epoch weights to RVF container - **Best-epoch snapshotting**: Trainer saves best validation loss weights and restores them before checkpoint/export - **Performance fix**: `CsiToPoseTransformer::zeros()` skips Xavier init for gradient estimation (avoids ~44K wasted constructions per batch) - **ADR-021**: Vital sign detection + RVF container format (closes #45) - **ADR-022**: Windows WiFi enhanced fidelity with multi-BSSID pipeline - **ADR-023**: Full DensePose training pipeline (Phases 1-8) - **Docker**: Reorganized into `docker/` directory with multi-stage Rust and Python images ## New Crates | Crate | Lines | Description | |-------|-------|-------------| | `wifi-densepose-vitals` | 1,863 | Breathing/HR detection, anomaly scoring, RVF storage | | `wifi-densepose-wifiscan` | 4,829 | Multi-BSSID scanning, netsh/WlanAPI adapters, 8-stage pipeline | ## New Modules (sensing-server) | Module | Lines | Description | |--------|-------|-------------| | `graph_transformer.rs` | 855 | Cross-attention + GNN transformer with weight serialization | | `trainer.rs` | 881 | 6-term loss, SGD+momentum, cosine LR, early stopping, checkpoints | | `dataset.rs` | 850 | MM-Fi + Wi-Pose loaders, windowing, normalization | | `sparse_inference.rs` | 753 | Neuron profiling, sparse forward, INT8/FP16 quantization | | `sona.rs` | 639 | LoRA adapters, EWC++ memory, environment profiles | | `rvf_container.rs` | 914 | Binary container format (manifest, weights, SONA, vitals) | | `rvf_pipeline.rs` | 1,027 | Progressive loading, HNSW index, overlay graph | | `vital_signs.rs` | 774 | Bandpass + FFT breathing/HR detection | ## Test Results - **239 tests passing** (157 lib + 48 RVF + 16 container + 18 vitals) - Zero compilation errors - 10 new integration tests for weight roundtrip, trainer+transformer, quantization accuracy ## Docker No Dockerfile changes required — the existing `docker/Dockerfile.rust` builds the same binary with new CLI flags automatically. Docker Hub images can be rebuilt at next release. ## Known Limitations (noted by review, not blocking) - Asymmetric quantization `zero_point` stored as `i8` (pre-existing, only affects `Int8Asymmetric` mode which is not the default) - Body part / UV loss terms use placeholder logic when transformer is active (scheduled for Phase 9) - `graph_edge_loss` not computed in training loop (loss weight has no effect) ## Test plan - [x] `cargo check -p wifi-densepose-sensing-server` — compiles cleanly - [x] `cargo test -p wifi-densepose-sensing-server` — 239 tests pass - [x] Weight roundtrip: `flatten_weights()` → `unflatten_weights()` produces identical forward output - [x] Quantized forward within 5% MSE of f32 forward - [x] Trainer with transformer produces finite loss across epochs - [x] Best-epoch params restored after `run_training()` - [ ] `cargo run -- --train --epochs 5 --save-rvf test.rvf` (manual) - [ ] `cargo run -- --model test.rvf --source simulate` (manual) 🤖 Generated with [claude-flow](https://github.com/ruvnet/claude-flow)
github-advanced-security[bot] (Migrated from github.com) reviewed 2026-03-01 13:00:54 +08:00
@@ -0,0 +26,4 @@
ENV PYTHONUNBUFFERED=1
CMD ["python", "-m", "v1.src.sensing.ws_server"]
github-advanced-security[bot] (Migrated from github.com) commented 2026-03-01 13:00:53 +08:00

Ensure that HEALTHCHECK instructions have been added to container images

Ensure that HEALTHCHECK instructions have been added to container images

Show more details

## Ensure that HEALTHCHECK instructions have been added to container images Ensure that HEALTHCHECK instructions have been added to container images [Show more details](https://github.com/ruvnet/wifi-densepose/security/code-scanning/5063)
github-advanced-security[bot] (Migrated from github.com) commented 2026-03-01 13:00:53 +08:00

Ensure that a user for the container has been created

Ensure that a user for the container has been created

Show more details

## Ensure that a user for the container has been created Ensure that a user for the container has been created [Show more details](https://github.com/ruvnet/wifi-densepose/security/code-scanning/5064)
@@ -0,0 +43,4 @@
ENV RUST_LOG=info
ENTRYPOINT ["/app/sensing-server"]
CMD ["--source", "simulated", "--tick-ms", "100", "--ui-path", "/app/ui"]
github-advanced-security[bot] (Migrated from github.com) commented 2026-03-01 13:00:54 +08:00

Ensure that HEALTHCHECK instructions have been added to container images

Ensure that HEALTHCHECK instructions have been added to container images

Show more details

## Ensure that HEALTHCHECK instructions have been added to container images Ensure that HEALTHCHECK instructions have been added to container images [Show more details](https://github.com/ruvnet/wifi-densepose/security/code-scanning/5061)
github-advanced-security[bot] (Migrated from github.com) commented 2026-03-01 13:00:54 +08:00

Ensure that a user for the container has been created

Ensure that a user for the container has been created

Show more details

## Ensure that a user for the container has been created Ensure that a user for the container has been created [Show more details](https://github.com/ruvnet/wifi-densepose/security/code-scanning/5062)
github-advanced-security[bot] (Migrated from github.com) reviewed 2026-03-01 13:02:03 +08:00
@@ -0,0 +1,26 @@
version: "3.9"
services:
sensing-server:
github-advanced-security[bot] (Migrated from github.com) commented 2026-03-01 13:02:02 +08:00

Container Capabilities Unrestricted

Docker compose file doesn't have 'cap_drop' attribute. Make sure your container only has necessary capabilities.

Show more details

## Container Capabilities Unrestricted Docker compose file doesn't have 'cap_drop' attribute. Make sure your container only has necessary capabilities. [Show more details](https://github.com/ruvnet/wifi-densepose/security/code-scanning/5066)
github-advanced-security[bot] (Migrated from github.com) commented 2026-03-01 13:02:02 +08:00

Healthcheck Not Set

Healthcheck is not defined.

Show more details

## Healthcheck Not Set Healthcheck is not defined. [Show more details](https://github.com/ruvnet/wifi-densepose/security/code-scanning/5070)
github-advanced-security[bot] (Migrated from github.com) commented 2026-03-01 13:02:02 +08:00

Memory Not Limited

'deploy' is not defined

Show more details

## Memory Not Limited 'deploy' is not defined [Show more details](https://github.com/ruvnet/wifi-densepose/security/code-scanning/5072)
github-advanced-security[bot] (Migrated from github.com) commented 2026-03-01 13:02:02 +08:00

Security Opt Not Set

Docker compose file does not have 'security_opt' attribute

Show more details

## Security Opt Not Set Docker compose file does not have 'security_opt' attribute [Show more details](https://github.com/ruvnet/wifi-densepose/security/code-scanning/5073)
github-advanced-security[bot] (Migrated from github.com) commented 2026-03-01 13:02:02 +08:00

Cpus Not Limited

'deploy' is not defined

Show more details

## Cpus Not Limited 'deploy' is not defined [Show more details](https://github.com/ruvnet/wifi-densepose/security/code-scanning/5076)
@@ -0,0 +6,4 @@
context: ..
dockerfile: docker/Dockerfile.rust
image: ruvnet/wifi-densepose:latest
ports:
github-advanced-security[bot] (Migrated from github.com) commented 2026-03-01 13:02:02 +08:00

Container Traffic Not Bound To Host Interface

Docker compose file doesn't have 'ports' attribute bound to a specific host interface

Show more details

## Container Traffic Not Bound To Host Interface Docker compose file doesn't have 'ports' attribute bound to a specific host interface [Show more details](https://github.com/ruvnet/wifi-densepose/security/code-scanning/5068)
@@ -0,0 +14,4 @@
- RUST_LOG=info
command: ["--source", "simulated", "--tick-ms", "100", "--ui-path", "/app/ui"]
python-sensing:
github-advanced-security[bot] (Migrated from github.com) commented 2026-03-01 13:02:02 +08:00

Container Capabilities Unrestricted

Docker compose file doesn't have 'cap_drop' attribute. Make sure your container only has necessary capabilities.

Show more details

## Container Capabilities Unrestricted Docker compose file doesn't have 'cap_drop' attribute. Make sure your container only has necessary capabilities. [Show more details](https://github.com/ruvnet/wifi-densepose/security/code-scanning/5065)
github-advanced-security[bot] (Migrated from github.com) commented 2026-03-01 13:02:02 +08:00

Healthcheck Not Set

Healthcheck is not defined.

Show more details

## Healthcheck Not Set Healthcheck is not defined. [Show more details](https://github.com/ruvnet/wifi-densepose/security/code-scanning/5069)
github-advanced-security[bot] (Migrated from github.com) commented 2026-03-01 13:02:02 +08:00

Memory Not Limited

'deploy' is not defined

Show more details

## Memory Not Limited 'deploy' is not defined [Show more details](https://github.com/ruvnet/wifi-densepose/security/code-scanning/5071)
github-advanced-security[bot] (Migrated from github.com) commented 2026-03-01 13:02:02 +08:00

Security Opt Not Set

Docker compose file does not have 'security_opt' attribute

Show more details

## Security Opt Not Set Docker compose file does not have 'security_opt' attribute [Show more details](https://github.com/ruvnet/wifi-densepose/security/code-scanning/5074)
github-advanced-security[bot] (Migrated from github.com) commented 2026-03-01 13:02:02 +08:00

Cpus Not Limited

'deploy' is not defined

Show more details

## Cpus Not Limited 'deploy' is not defined [Show more details](https://github.com/ruvnet/wifi-densepose/security/code-scanning/5075)
@@ -0,0 +19,4 @@
context: ..
dockerfile: docker/Dockerfile.python
image: ruvnet/wifi-densepose:python
ports:
github-advanced-security[bot] (Migrated from github.com) commented 2026-03-01 13:02:02 +08:00

Container Traffic Not Bound To Host Interface

Docker compose file doesn't have 'ports' attribute bound to a specific host interface

Show more details

## Container Traffic Not Bound To Host Interface Docker compose file doesn't have 'ports' attribute bound to a specific host interface [Show more details](https://github.com/ruvnet/wifi-densepose/security/code-scanning/5067)
Sign in to join this conversation.