Files
rustytorch/resume_nextplan.md
T
2026-03-04 00:08:42 +00:00

528 lines
13 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# RustyStack Next-Gen Demo Implementation - Resume Document
**Created:** 2026-01-12
**Purpose:** Resume point for implementing 20 next-generation demos
---
## Current State
- **Existing Demos:** 18/18 complete (100%)
- **New Demos Planned:** 20
- **Status:** Ready to begin implementation
---
## Execution Order
```
Phase 1: MEDICAL (Demos 1-5)
Phase 2: FINANCE (Demos 6-9)
Phase 3: AI/ML CORE (Demos 10-13)
Phase 4: ENGINEERING (Demos 14-17)
Phase 5: TB5 CLUSTER (Demos 18-20)
```
---
## Demo Checklist
### Phase 1: MEDICAL
| # | Demo | Crate | Status |
|---|------|-------|--------|
| 1 | AlphaFold-Lite | `rtx-alphafold-demo` | [x] Complete (31 tests) |
| 2 | CellAtlas | `rtx-cellatlas-demo` | [x] Complete (42 tests) |
| 3 | DrugBinder | `rtx-drugbinder-demo` | [ ] Not Started |
| 4 | CardioSim | `rtx-cardiosim-demo` | [ ] Not Started |
| 5 | TumorBoard AI | `rtx-tumorboard-demo` | [ ] Not Started |
### Phase 2: FINANCE
| # | Demo | Crate | Status |
|---|------|-------|--------|
| 6 | QuantumPort | `rtx-quantumport-demo` | [ ] Not Started |
| 7 | MarketSim | `rtx-marketsim-demo` | [ ] Not Started |
| 8 | RiskFlow | `rtx-riskflow-demo` | [ ] Not Started |
| 9 | AlgoArena | `rtx-algoarena-demo` | [ ] Not Started |
### Phase 3: AI/ML CORE
| # | Demo | Crate | Status |
|---|------|-------|--------|
| 10 | NeuralOp Studio | `rtx-neuralop-demo` | [ ] Not Started |
| 11 | WorldGen | `rtx-worldgen-demo` | [ ] Not Started |
| 12 | EmbodiedSim | `rtx-embodied-demo` | [ ] Not Started |
| 13 | FoundationForge | `rtx-forge-demo` | [ ] Not Started |
### Phase 4: ENGINEERING
| # | Demo | Crate | Status |
|---|------|-------|--------|
| 14 | AeroFlow | `rtx-aeroflow-demo` | [ ] Not Started |
| 15 | WeatherCast | `rtx-weathercast-demo` | [ ] Not Started |
| 16 | SeismicAI | `rtx-seismic-demo` | [ ] Not Started |
| 17 | StructuralPINN | `rtx-structural-demo` | [ ] Not Started |
### Phase 5: TB5 CLUSTER
| # | Demo | Crate | Status |
|---|------|-------|--------|
| 18 | ClusterViz | `rtx-clusterviz-demo` | [ ] Not Started |
| 19 | DistributedLLM | `rtx-distllm-demo` | [ ] Not Started |
| 20 | FederatedMed | `rtx-fedmed-demo` | [ ] Not Started |
---
## File Structure Per Demo
```
demos/
├── rtx-{name}-demo/ # Backend crate
│ ├── Cargo.toml
│ └── src/
│ ├── lib.rs # Core algorithms
│ ├── models.rs # ML models
│ └── sample_data.rs # Demo datasets
├── {name}-shared/ # IPC types
│ ├── Cargo.toml
│ └── src/lib.rs
└── ui/src-tauri/src/
└── {name}_commands/ # Tauri commands
├── mod.rs
└── commands.rs
```
---
## Demo Specifications
### Demo 1: AlphaFold-Lite
**Purpose:** Protein structure prediction from amino acid sequence
**Core Components:**
- `ProteinEncoder` - Amino acid embeddings + positional encoding
- `PairwiseAttention` - Residue-residue interactions
- `InvariantPointAttention` - SE(3)-equivariant attention
- `StructureModule` - 3D coordinate prediction
- `pLDDT` - Confidence scoring
**UI Features:**
- Sequence input with validation
- 3D protein visualization (Three.js)
- Confidence coloring
- PDB export
---
### Demo 2: CellAtlas
**Purpose:** Single-cell spatial transcriptomics foundation model
**Core Components:**
- `CellTransformer` - Self-attention over ~20,000 genes
- `GraphNN` - Spatial encoder for tissue context
- `CellTypeClassifier` - Cell type prediction
- `NichePredictor` - Spatial niche analysis
**UI Features:**
- UMAP/t-SNE visualization
- Cell type annotation
- Spatial tissue map
- Gene expression heatmap
---
### Demo 3: DrugBinder
**Purpose:** Drug-target binding affinity prediction
**Core Components:**
- `MoleculeEncoder` - Graph neural network for molecules
- `ProteinEncoder` - Protein pocket encoding
- `CrossAttention` - Protein-ligand interaction
- `MoleculeDiffusion` - Generative molecule design
**UI Features:**
- SMILES input / molecular editor
- Protein pocket visualization
- Binding pose prediction
- Virtual screening table
---
### Demo 4: CardioSim
**Purpose:** Cardiac electrophysiology simulation
**Core Components:**
- `CardiacPINO` - Physics-informed neural operator
- `MonodomainLoss` - PDE constraint (∂V/∂t = ∇·(D∇V) + Iion)
- `HeartMesh` - 3D heart geometry with fiber orientation
- `IonicModel` - Mitchell-Schaeffer or similar
**UI Features:**
- 3D heart visualization
- Real-time voltage propagation
- Arrhythmia simulation
- Pacing protocol editor
---
### Demo 5: TumorBoard AI
**Purpose:** Multi-modal medical imaging analysis
**Core Components:**
- `CTAnalyzer` - 3D CNN for CT
- `MRIAnalyzer` - Multi-sequence MRI
- `PathologyAnalyzer` - SlideScope integration
- `MultiModalFusion` - Cross-modal attention
- `ReportLLM` - Natural language generation
**UI Features:**
- Multi-panel viewer
- AI-generated report
- Evidence highlighting
- Case comparison
---
### Demo 6: QuantumPort
**Purpose:** Higher-order portfolio optimization
**Core Components:**
- `QuantumPortfolio` - Covariance, coskewness, cokurtosis tensors
- `HOPOptimizer` - QAOA-inspired classical optimizer
- `PortfolioMetrics` - Return, volatility, skewness, kurtosis, VaR, CVaR
**UI Features:**
- 3D efficient frontier (with skewness axis)
- Risk-return tradeoff slider
- Portfolio composition chart
- Mean-Variance vs Higher-Order comparison
---
### Demo 7: MarketSim
**Purpose:** Financial world model for scenario generation
**Core Components:**
- `MarketWorldModel` - State encoder + dynamics model
- `ScenarioGenerator` - Diffusion-based generation
- `ScenarioConditioner` - Text conditioning ("2008 crisis")
- `BacktestEngine` - Strategy evaluation
**UI Features:**
- Scenario description input
- Multi-path price visualization
- Portfolio stress testing
- Historical comparison
---
### Demo 8: RiskFlow
**Purpose:** Real-time risk attribution
**Core Components:**
- `NeuralRiskModel` - Factor-based risk prediction
- `GradientAttribution` - Explainability
- `RiskFactors` - Market, size, value, momentum, volatility
- `RiskStream` - Real-time updates
**UI Features:**
- Real-time dashboard
- Factor waterfall chart
- VaR/CVaR gauges
- Position drill-down
---
### Demo 9: AlgoArena
**Purpose:** Multi-agent trading simulation
**Core Components:**
- `TradingArena` - Market simulator + order book
- `TradingAgent` trait - Strategy interface
- Built-in agents: Momentum, MeanReversion, RL, LLM
- `ArenaMetrics` - Performance tracking
**UI Features:**
- Tournament bracket
- Real-time P&L chart
- Order flow visualization
- Strategy leaderboard
---
### Demo 10: NeuralOp Studio
**Purpose:** Neural operator workbench for PDEs
**Core Components:**
- `FourierNeuralOperator` - Spectral convolution layers
- `DeepONet` - Branch + trunk networks
- `SINO` - Spectral-inspired operator
- `PDEDefinition` - Equation, domain, BCs, IC
**UI Features:**
- LaTeX equation editor
- Domain geometry editor
- Training progress
- Solution comparison
---
### Demo 11: WorldGen
**Purpose:** Video diffusion world simulator
**Core Components:**
- `VideoDiT` - Diffusion transformer for video
- `Patchify3D` / `Unpatchify3D` - Spatiotemporal patches
- `PhysicsConditioner` - Physics constraint loss
- `TemporalAttention` - Spatial + temporal + cross attention
**UI Features:**
- Text prompt input
- Physics constraint toggles
- Video preview player
- Frame-by-frame inspection
---
### Demo 12: EmbodiedSim
**Purpose:** Robotics world model for sim-to-real
**Core Components:**
- `RSSM` - Recurrent state space model (DreamerV3-style)
- `JEPA` - Joint embedding predictive architecture
- `ActorCritic` - Policy and value networks
- `ObservationEncoder/Decoder` - Visual encoding
**UI Features:**
- Simulation viewer
- Imagined trajectory rollout
- Latent space visualization
- Reward prediction graph
---
### Demo 13: FoundationForge
**Purpose:** Model compression and distillation
**Core Components:**
- `Quantizer` - PTQ, QAT, GPTQ (4/8/16-bit)
- `Pruner` - Magnitude/movement pruning
- `Distiller` - Knowledge distillation (KL, MSE, attention)
**UI Features:**
- Architecture visualizer
- Compression ratio slider
- Accuracy vs size chart
- Export to ONNX/CoreML/TFLite
---
### Demo 14: AeroFlow
**Purpose:** Aircraft CFD with neural operators
**Core Components:**
- `AeroflowOperator` - Geometry encoder + FNO
- `NavierStokesLoss` - Physics constraint
- `FlowField` - Pressure + velocity fields
- `AeroCoefficients` - Cd, Cl, Cm
**UI Features:**
- Airfoil geometry editor
- Flow field visualization
- Real-time Cd/Cl display
- Shape optimization
---
### Demo 15: WeatherCast
**Purpose:** Regional weather prediction
**Core Components:**
- `WeatherTransformer` - GraphCast-style architecture
- `IcosahedralMeshEncoder` - Spherical mesh encoding
- `AtmosphericState` - T, Z, q, u, v at pressure levels
**UI Features:**
- Interactive globe/map
- Variable selector
- Time slider for forecast
- Uncertainty bands
---
### Demo 16: SeismicAI
**Purpose:** Earthquake simulation and early warning
**Core Components:**
- `SeismicOperator` - Wave equation FNO
- `EarthquakeSource` - Location, depth, magnitude, mechanism
- `GroundMotion` - PGA, PGV, arrival times
**UI Features:**
- Map with fault lines
- Source parameter controls
- Ground motion visualization
- Arrival time isochrones
---
### Demo 17: StructuralPINN
**Purpose:** Structural mechanics solver
**Core Components:**
- `StructuralPINN` - Geometry MLP + stress network
- `ElasticityLoss` - Navier-Cauchy equations
- `Material` - E, ν, ρ
- `StressField` - σxx, σyy, σzz, σxy, von Mises
**UI Features:**
- Geometry editor (2D/3D)
- Load/constraint application
- Stress/strain visualization
- Safety factor display
---
### Demo 18: ClusterViz
**Purpose:** TB5 cluster monitoring and visualization
**Core Components:**
- `ClusterTopology` - RNCCL topology discovery
- `ClusterMetrics` - GPU util, memory, bandwidth
- `CollectiveTrace` - Operation tracing
**UI Features:**
- 3D topology view
- Real-time bandwidth heatmap
- Collective operation animation
- Bottleneck alerts
---
### Demo 19: DistributedLLM
**Purpose:** Trillion-parameter inference on Mac cluster
**Core Components:**
- `TensorParallelLLM` - Column/row parallelism
- `PipelineParallelLLM` - Stage-based parallelism
- `FlashAttention` - Memory-efficient attention
- `RncclComm` - RNCCL communicator
**UI Features:**
- Chat interface
- Layer distribution visualization
- Token generation speed
- Memory usage per node
---
### Demo 20: FederatedMed
**Purpose:** Privacy-preserving medical AI training
**Core Components:**
- `FederatedCoordinator` - Global model + FedAvg
- `FederatedClient` - Local training
- `DifferentialPrivacy` - ε, δ, clip norm, noise
**UI Features:**
- Node status dashboard
- Global accuracy curve
- Privacy budget tracker
- Communication rounds visualization
---
## Research References
### Medical AI
- AlphaFold 3: https://arxiv.org/html/2508.18446v1
- Nicheformer: https://www.nature.com/articles/s41592-025-02814-z
- Drug Discovery Diffusion: https://arxiv.org/abs/2506.14488
- Cardiac PINO: https://arxiv.org/abs/2511.08418
- TissueLab Agentic: https://arxiv.org/html/2509.20279v1
### Finance
- Higher-Order Portfolio QAOA: https://arxiv.org/abs/2509.01496
- Quantum Portfolio Benchmark: https://arxiv.org/html/2509.17876v1
### Neural Operators
- PINNs/Neural Ops Survey: https://arxiv.org/abs/2511.04576
- Data-Free Navier-Stokes: https://arxiv.org/abs/2510.23936
- SINO: https://arxiv.org/abs/2505.21573
### World Models
- Embodied AI Survey: https://arxiv.org/abs/2510.16732
- World Models Survey: https://arxiv.org/abs/2507.00917
- Sora Technical: https://openai.com/index/video-generation-models-as-world-simulators/
### Weather/Climate
- Weather Prediction Survey: https://arxiv.org/html/2501.06907v1
### Thunderbolt Clustering
- 1.5TB VRAM Mac Cluster: https://www.jeffgeerling.com/blog/2025/15-tb-vram-on-mac-studio-rdma-over-thunderbolt-5/
- macOS Tahoe 26.2 RDMA: https://appleinsider.com/articles/25/11/18/macos-tahoe-262-will-give-m5-macs-a-giant-machine-learning-speed-boost
---
## RNCCL Capabilities (Verified from Codebase)
**Transports:**
- METAL_DIRECT: 400 GB/s (zero-copy same-process)
- METAL_UMA: 200 GB/s (Apple Silicon unified memory)
- METAL_SHM: 50 GB/s (cross-process shared memory)
- METAL_THUNDERBOLT: 5 GB/s (multi-node via TB4/TB5)
**Collectives:**
- AllReduce, AllGather, ReduceScatter
- Broadcast, Reduce, AllToAll
- Scatter, Gather, Send/Recv
**Algorithms:**
- Ring, Tree, Recursive Halving-Doubling
- NVLS, PAT, CollNet
---
## Resume Instructions
1. Read this document to understand current state
2. Check the checklist above for which demos are complete
3. Continue with the next uncompleted demo
4. For each demo:
- Create backend crate (`rtx-{name}-demo`)
- Create shared types crate (`{name}-shared`)
- Create Tauri commands
- Add UI components
- Run tests
- Update checklist in this document
---
## Commands
```bash
# Build all demos
cd /home/osobh/data/rustystack/rustytorch
cargo check --workspace
# Run tests
cargo test --workspace
# Run UI
cd demos/ui
pnpm tauri dev
# Commit changes
git add . && git commit -m "feat: add {demo-name} demo"
git push origin main
```
---
## Notes
- Full plan details in: `/home/osobh/.claude/plans/imperative-sauteeing-nebula.md`
- Gitea remote: `https://gitea.smartpi.ai/rustystack/rustytorch.git`
- Each demo follows the existing pattern from the 18 completed demos