07 · AI SYSTEM
ML architecture · Training pipeline · AI Coach · AI Wallet Agent · AI Insurance Agent · Predictive analytics
⚠️ AI Yield Engine optimizes allocation but does not guarantee returns. Target Yield depends on DeFi market conditions.
1. Overview
The Wellex AI system consists of five interconnected components united by the Lazy Factor principle: the user does the minimum — AI handles everything else.
| # | Component | Purpose | Deployment |
|---|---|---|---|
| 1 | AI Coach | Wellness recommendations (video / audio / text) | On-device + Cloud |
| 2 | AI Wallet Agent | Auto-compound, rebalancing, 800+ ML strategies, risk management | Cloud (server-side) |
| 3 | AI Insurance Agent | Risk assessment, personalized insurance recommendations | Cloud |
| 4 | AI Dashboard Agents | Promotion, content, analytics, mentoring | Cloud |
| 5 | Predictive Analytics Engine | Health, churn, and income forecasting | Cloud |
2. AI Coach
2.1 Pipeline Architecture
Wellex Band → BLE → Raw Biometrics
↓
Feature Engine (on-device)
HRV, sleep stages, activity, emotions, stress index
↓
Context Builder
WVI, 7-day trend, weak spots, time of day,
user profile, recommendation history
↓
Fine-tuned LLM
Llama 3.1 8B (on-device) / GPT-4o (cloud, complex queries)
↓
Output: 🎥 Video · 🎧 Audio · 📝 Text + Personalized action plan
2.2 ML Models
| Model | Architecture | Input | Output | Accuracy |
|---|---|---|---|---|
| Emotion Classifier | XGBoost ensemble | HRV + EDA (12 features) | 11 emotions + confidence | 78.2% (11-class) |
| Sleep Staging | 1D-CNN + BiLSTM | PPG + Accel (30 s epochs) | Wake / N1 / N2 / N3 / REM | κ = 0.72 |
| Activity Classifier | LightGBM | Accel + Gyro + HR | 12 workout types | 91.3% |
| Stress Predictor | LSTM (seq2seq) | HRV time series (5 min) | Stress score + 1 h forecast | MAE = 6.2 |
| Recommendation LLM | Fine-tuned Llama 3.1 8B | Context vector + user profile | Text recommendation | Human eval: 4.3/5 |
| Content Generator | GPT-4o (API) | Recommendation + format | Video script / audio text | Human eval: 4.5/5 |
2.3 Training Pipeline
1. Data collection
├── WESAD (PPG + EDA, N = 15)
├── AMIGOS (multimodal, N = 40)
├── Sleep-EDF (PSG-verified, N = 197)
├── Wellex proprietary (N = 3,200+)
└── Continuous collection from users (opt-in)
2. Preprocessing
├── Artifact removal (PPG motion artifacts)
├── Bandpass filtering (0.5–40 Hz for PPG)
├── RR interval extraction (Pan-Tompkins)
├── Feature extraction (time + frequency domain)
└── Normalization (per-user z-score)
3. Training
├── 80/10/10 split (train / val / test)
├── 5-fold cross-validation
├── Hyperparameter tuning (Optuna)
├── Class balancing (SMOTE + class weights)
└── Early stopping (patience = 10)
4. Validation
├── Hold-out test set
├── Cross-dataset validation
├── A/B testing of recommendations
└── Expert review (clinical advisory board)
5. Deployment
├── ONNX export → CoreML / TFLite
├── On-device inference (< 50 ms)
├── Cloud fallback for complex queries
├── Model versioning (MLflow)
└── Gradual rollout (5% → 25% → 100%)
6. Continuous learning
├── Federated learning (no raw data transfer)
├── Monthly retraining
├── Drift detection (PSI > 0.2 → retrain)
└── User feedback loop
2.4 Personalized Recommendations
| Type | Trigger | Example | Format |
|---|---|---|---|
| Morning | Every morning | "Recovery 74. Good day for moderate load" | Push + Text |
| Preventive | HRV drop > 15% | "Stress rising — 4-7-8 breathing for 5 min" | Push + Video |
| Sleep correction | Sleep < 6 h | "Sleep 5 h 20 min last night — go to bed by 22:30" | Push + Text |
| Motivation | WVI near yield threshold | "Next Monthly Yield level +8 WVI! A walk will help" | Push + Audio |
| Evening | 21:00–22:00 | "Avoid coffee and screens after 22:00, fall asleep by 23:00" | Push + Text |
| Weekly | Sunday | Video report: trends, achievements, plan for the week | Video (3 min) |
| Milestone | Streak / level up | "30-day streak! Monthly Yield bonus +0.5%" | Push + Animation |
Personalization factors: age, gender, fitness level, chronotype, recommendation history (no repeats), effectiveness of past advice (CTR, follow-through rate), preferred format (video / text).
2.5 AI Coach Pricing
| Pricing tier | Cost | Capabilities |
|---|---|---|
| Basic | $0/mo | Basic text recommendations, WVI |
| Wellex Subscription | $19/mo | Full AI Coach: video / audio, detailed analytics, free band |
3. AI Wallet Agent
3.1 Architecture
Data sources
├── The Graph (protocol TVL, Monthly Yield)
├── DeFiLlama API (cross-protocol)
├── Chainlink (price feeds)
└── Internal analytics (user behavior)
↓
Gauntlet-style simulation · 10,000 scenarios per decision
↓
Decision Engine (PPO agent)
State: market conditions + portfolio
Action: rebalancing / compound
Reward: risk-adjusted return
↓
TX Builder
Ethers.js + Tenderly Simulation → Gelato Keeper execution
3.2 Autonomous AI Actions
| Action | Condition | Example |
|---|---|---|
| Auto-compound yield | When activated ($129) | Reinvest yield → WellexVault |
| Reward harvesting | Always | CRV, COMP → convert to USDC → vault |
| DeFi allocation rebalancing | Deviation > 5% from target | Lending/AMM/RWA → rebalance to optimal |
| Cross-chain transfer | Yield differential > 2% | Move USDC liquidity from BSC to Ethereum via LayerZero |
| Gas optimization | Always | Batching UserOps, low-gas windows |
| Emergency withdrawal | Depeg > 2%, exploit detected | Instant withdrawal to stablecoins |
3.3 Actions Requiring User Confirmation
| Action | Reason |
|---|---|
| Withdrawal to external address | Security |
| Strategy change | Risk profile change |
| Allocation outside whitelist | Smart contract risk |
| Operations > 25% of portfolio in 24 h | Protection from large moves |
3.4 AI Wallet Agent Allocation (Unified WellexVault)
The AI Wallet Agent manages a single WellexVault (ERC-4626). Manual strategy selection by the user is not available — AI automatically optimizes DeFi allocation distribution based on market conditions and the user's WVI.
| DeFi category | Allocation target | Protocols |
|---|---|---|
| Lending | 35–55% | Aave v3, Compound III, Morpho |
| AMM fees / LP | 10–20% | Uniswap v3, Curve |
| RWA / Treasuries | 10–25% | Ondo USDY, Mountain USDM |
| Liquidity incentives | 5–15% | CRV/CVX incentives, LM programs |
| Rate/basis arbitrage | 0–10% | Funding/basis, cross-protocol spreads |
| Structured strategies | 0–15% | Delta-neutral, covered/hedged structures |
| Cash buffer | 5–10% | USDC — for gas and rebalancing |
Auto AI principles:
- Allocation reviewed daily (response to market conditions)
- High WVI (≥70) → AI allows more complex strategies (higher expected yield)
- Low WVI (<40) → AI reduces incentives/structured share → conservative allocation
- Tenderly simulation of each transaction before execution
Expected Monthly Yield (from WellexVault) is strictly determined by the user's WVI per the unified table in REBUILD_PLAN.md. Actual yield depends on DeFi market conditions.
4. AI Insurance Agent
4.1 Concept
The AI Insurance Agent analyzes biometric data and the user's financial profile to generate personalized insurance recommendations.
4.2 Architecture
Input data:
├── WVI history (30 / 90 / 365 days)
├── Biometric trends (HRV, sleep, activity)
├── Age, gender, BMI, lifestyle factors
├── Deposit and yield history
└── Regional factors (healthcare costs)
↓
Risk Scoring Engine
Actuarial model + ML (Gradient Boosting / XGBoost)
Trained on insurance datasets
↓
Outputs:
├── Personal Health Risk Score (0–100)
├── Recommended insurance type and coverage
├── Premium calculation (insurance partners)
├── Preventive recommendations (premium reduction)
└── "Saved $X thanks to your WVI"
4.3 Functions
| Function | Description |
|---|---|
| Health Risk Score | ML risk assessment based on 90+ days of biometrics |
| Coverage Recommendations | Insurance type and coverage based on user profile |
| Premium Optimization | "Your WVI 80 → 15% discount with partner X" |
| Preventive Actions | "Add 1 h of sleep → 8% risk score reduction" |
| Claims Assistant | AI assistance with insurance claim filing |
| Partner Marketplace | Offers from partner insurance companies |
4.4 Monetization
| Source | Rate |
|---|---|
| Commission from insurance partners | 5–15% of insurance premium |
| Lead generation | $20–50 per qualified lead |
| Detailed Health Risk Report | Included in $19/mo subscription |
5. AI Dashboard Agents
5.1 "Promotion" Agent
| Function | Description |
|---|---|
| Reactivation | Detect inactive partners → personalized scripts |
| Audience analysis | Partner profile → channel acquisition recommendations |
| Forecasting | "+3 referrals/mo → Master rank in 6 mo, income ~$1,700" |
| Weekly plan | Step-by-step action plan with priorities |
5.2 "Content" Agent
| Function | Description |
|---|---|
| Post generation | Instagram, Telegram, Facebook — by prompt or automatically |
| Video scripts | Scripts for Reels, TikTok, YouTube Shorts |
| Stories | Ready visuals + text |
| Prompting training | Help crafting effective prompts |
5.3 "Analytics" Agent (Guardian+)
| Function | Description |
|---|---|
| Funnel | Invitations → Registrations → Active → Paying |
| Bottlenecks | "80% drop-off at band connection — help the team" |
| Cohort analysis | Retention by acquisition month |
5.4 "Mentoring" Agent (Master+)
| Function | Description |
|---|---|
| Team training | Webinar templates, call scripts |
| Delegation | "@user1 ready for Guardian rank — help close 3 referrals" |
| Team WVI | Recommendations for growing team average WVI |
6. Predictive Analytics Engine
6.1 Models
| Model | Task | Architecture | Horizon | Metric |
|---|---|---|---|---|
| WVI Forecast | 7/30-day WVI forecast | LSTM (seq2seq) | 7–30 days | MAE = 4.1 |
| Churn Predictor | Churn probability | Gradient Boosting | 30 days | AUC = 0.87 |
| Monthly Yield Optimizer | Optimal strategy | RL (PPO) | Real-time | Sharpe > 1.8 |
| Health Alert | Early warning of issues | Anomaly detection (Isolation Forest) | 24–72 h | Precision = 0.82 |
| Revenue Forecast | MRR / ARR forecast | Prophet + XGBoost | 3–12 mo | MAPE = 8% |
| Network Growth | Partner network growth | Graph Neural Network | 1–6 mo | MAE = 12% |
6.2 Predictive Insight Examples
For the user:
- "HRV has been declining for three days. 72% probability WVI will drop below 60 tomorrow. Recommendation: walk + sleep by 22:00"
- "At current trajectory, March Monthly Yield will be 14.2%. For 16% you need +4 to average WVI"
For the administrator:
- "February cohort: 30d retention = 78%, 90d forecast = 62%. Bottleneck: 23% did not connect the band"
- "Q2 TVL forecast: $8.2M (+95% vs current). Risk in market correction: $5.1M"
7. Technology Stack
| Component | Technology | Purpose |
|---|---|---|
| On-device LLM | Llama 3.1 8B (ONNX → CoreML / TFLite) | Wellness recommendations (< 50 ms) |
| Cloud LLM | GPT-4o / Claude API | Complex queries, content generation |
| ML Framework | PyTorch 2.x + Lightning | Model training |
| ML Serving | ONNX Runtime (device), TorchServe (cloud) | Inference |
| Experiment Tracking | MLflow + Weights & Biases | Metrics, artifacts |
| Hyperparameter Tuning | Optuna | Automated HPO |
| Feature Store | Feast (on Redis) | Real-time + batch features |
| Data Pipeline | Apache Airflow | ETL, retraining schedules |
| Vector DB | Qdrant | Similarity search for recommendations |
| RL Environment | Gymnasium + Stable Baselines3 | Wallet Agent training |
| Market Data | The Graph + DeFiLlama API | Monthly Yield, TVL, utilization |
| TX Builder | Ethers.js + Tenderly Simulation | Transaction building and verification |
| Keeper | Gelato Web3 Functions | On-chain execution |
| Monitoring | Forta + custom alerts | Anomaly detection |
| Notifications | Firebase + Telegram Bot API | Push notifications |
8. AI Security
Three-Layer Protection
Layer 1 — Smart Contract Limits (on-chain)
- Protocol whitelist (updates via governance)
- Maximum transaction size per action
- Daily volume limit (25% of portfolio)
- Emergency pause (multisig 2-of-3)
- Rate limits (5% TVL/h)
Layer 2 — AI Guardrails (off-chain)
- Risk assessment for each transaction (1–100 scale)
- Anomaly detection (Isolation Forest)
- Tenderly simulation before execution
- Auto-reject when risk score > 70 without user confirmation
- Human-in-the-loop for operations > $50,000
Layer 3 — User Controls
- Instant AI pause (Pause Agent)
- Override any AI decision
- User-defined limits (max per tx, daily cap)
- Full manual mode (AI disabled)
- Activity log (all AI actions are transparent)
9. Data Privacy
| Principle | Implementation |
|---|---|
| On-device first | Basic inference on device; raw data never leaves the phone |
| E2E encryption | Biometrics encrypted with AES-256 before cloud upload |
| Federated learning | Models improve without transferring raw data to server |
| Data minimization | Server receives only WVI score + aggregated features |
| User control | Export / delete all data (GDPR Art. 17) |
| Anonymization | Research uses only de-identified data |
→ Related documents: 04_APP_UX.md (AI assistant screen) · 05_DASHBOARD.md (AI Dashboard Agents) · 06_YIELD_PROTOCOL.md (yield mechanics) · 08_HARDWARE.md (band data)
Wellex © 2026 · Confidential