Regime-Aware Multi-agent Portfolio Allocation with Risk-checked Trading — a coordination-first portfolio system, built evaluation-first and reported honestly.
Research & simulation only. Not investment advice. No live trading. All prices are synthetic; the system is designed to never place a real order.
RAMPART studies whether a coordinated set of specialist strategies, dispatched by a regime-aware supervisor and constrained by deterministic risk guardrails, can outperform both a monolithic RL agent and naive baselines on out-of-sample, after-cost portfolio allocation. The system separates decision-making (RL + deterministic policies) from a natural-language layer (goal parsing and grounded explanation) that never touches allocations. Every component — including the coordinator itself — is scored with a purged walk-forward backtest against honest benchmarks. The central empirical result is reported without spin: with posterior blending (mixing specialists by regime probability rather than hard-switching), coordination beats both a monolithic RL agent and equal-weight (1/N) on trending data; under regime switching it does not beat 1/N, because the blend's reweighting turnover overwhelms its diversification benefit. Both outcomes are reported truthfully.
Most RL-trading demonstrations report in-sample returns on a single asset and stop there — which tells you almost nothing, because the hard part of quantitative finance is evaluation, not optimization. This project inverts the usual emphasis: the evaluation harness is the primary artifact, and every strategy is judged the way a skeptic would judge it — out of sample, after realistic costs, against benchmarks that are notoriously hard to beat. The question is not "can we make a number go up in-sample?" but "does coordination produce a defensible, falsifiable advantage?"
A two-plane multi-agent architecture. Money decisions are deterministic and validated; the language layer only interprets goals and explains outcomes.
INTERACTION PLANE (post-hoc, never decides money)
Supervisor natural-language goal -> mandate(capital, risk)
Explainer rationale, verified against the realized allocation
|
v
DECISION PLANE (RL + deterministic, validated)
Router regime detection (trend / vol) + confidence + hysteresis
v
Specialists momentum | markowitz | risk_parity | min_variance | defensive_cash | rl_ppo
v
Verifier feasibility · concentration cap · turnover · repair-or-fallback
v
Allocation + provenance (regime, specialist, guardrail status)
- Regime router classifies the market and dispatches to the specialist suited to it
(
bull→momentum,bear→defensive_cash,high_vol→risk_parity,neutral→markowitz), diversifying to risk-parity when confidence is low. Two modes: hard routing (one specialist, with hysteresis to damp whipsaw) and soft blending (an adaptive, EMA-smoothed regime posterior that mixes specialists by probability). - Specialist bank — six heterogeneous strategies (momentum, mean-variance, risk-parity, min-variance, defensive-cash, and a learned PPO policy) so that comparative advantage is genuine rather than cosmetic.
- Deterministic verifier — enforces feasibility, a risk-dependent concentration cap (35 / 60 / 85% for conservative / balanced / aggressive), and a turnover budget; it repairs an over-concentrated proposal once, then falls back to a safe default. Specialist failures, NaNs, and stale data degrade gracefully.
- Coordinator — composes the above and is itself a strategy, so it can be backtested head-to-head against the individuals.
- Grounded explanation — the natural-language rationale is automatically checked against the realized weights, regime, and top holding (an anti-hallucination guard).
An evaluation harness designed for honesty.
- Purged, embargoed walk-forward splitting (no train/test leakage).
- Realistic costs: bid–ask spread + commission + square-root market impact.
- Honest benchmarks: buy-and-hold, equal-weight (1/N), Markowitz.
- Frequency-aware risk metrics (Sharpe, Sortino, max drawdown, Calmar, turnover) on excess-over-risk-free returns.
- Reproducibility: seeded end-to-end; identical seeds give identical results.
- Loud data quality: NaN/inf raise rather than being silently zero-filled.
- An ablation that pits the coordinator against the monolithic RL agent, the best single specialist in hindsight, and 1/N — and prints a verdict either way.
On the bundled synthetic data, out-of-sample and after costs (Sharpe):
- Single-trend regime — soft blending beats both 1/N and the monolithic RL agent in real time (≈1.19 vs 0.83 for 1/N and −0.76 for the monolith), approaching the best single specialist in hindsight (≈1.27, an unachievable look-ahead bound). Crucially, hard switching alone scored only ≈0.04 — blending is what makes routing competitive. Among individuals, momentum earns the highest Sharpe but the deepest drawdown; the PPO agent is the weakest, and the harness shows that rather than hiding it.
- Regime-switching regime — coordination still does not beat 1/N (blending ≈ −0.52, hard ≈ −0.44, 1/N ≈ 0.23). Under fast regime changes the blend's continuous reweighting costs more in turnover than it gains in diversification, and detection lag causes whipsaw.
- How you combine specialists matters more than which you pick. Hard switching whipsaws and barely beats break-even; mixing specialists by a smoothed regime posterior (soft blending) is what lets coordination beat 1/N and the monolith on trending data. The coordination scheme, not the bank, is the lever.
- Blending is not free, and the right scheme is regime-dependent. Its edge comes from diversifying across specialists, but continuous reweighting costs turnover. Under fast regime switching that cost dominates and blending underperforms even hard routing — so a production system would gate blending on regime stability.
- Regime timing is hard, and 1/N is a strong adversary. A lagging detector buys trends after they have run and turns defensive after drawdowns have happened. That equal-weight is difficult to beat is a well-documented result (DeMiguel, Garlappi & Uppal, 2009); reproducing it here is a sign the evaluation is honest, not broken.
- The contribution is engineering and governance, not alpha. The defensible value is a fault-tolerant, auditable allocation pipeline — routing, deterministic guardrails with repair, provenance, and grounded explanations — plus an evaluation harness that will report a negative result. A system that always claimed to win would be the less trustworthy one.
- Beating the monolith is the fair comparison; "best-in-hindsight" is not. Selecting the ex-post winner uses look-ahead; the relevant question is whether real-time routing improves on a single learned policy, and it does.
- Risk preference is causal, not cosmetic. The mandate's risk level flows into the verifier's concentration cap and visibly reshapes the allocation (e.g. a momentum concentration is repaired under a conservative cap).
- Negative results are first-class output. The point of the harness is to make the system falsifiable; honestly published failure is the evidence that the positive claims can be trusted.
- Prices are synthetic by design (license-clean, simulation-only); regimes are properties of the generator, not a real market.
- Regime detection is a simple trend/volatility classifier and lags by construction.
- The PPO specialist underperforms classical strategies on this data.
- Execution realism stops at a cost model; there is no order-book microstructure or live data.
make install # environment + dependencies
make data # deterministic synthetic panel
make test # full test suite
make backtest # walk-forward leaderboard
make ablation # routed vs monolith vs best-single vs 1/N (add --regime-switching)docs/dashboard-guide.md— how to read each panel of the dashboarddocs/metrics-glossary.md— every metric and term defineddocs/interpreting-results.md— what the output does and does not prove
Educational research platform. Synthetic data only. Not investment advice. Not for live trading. No allocation shown here should be relied upon for real capital.