Comparing structured (Knowledge Graph) vs unstructured (RAG) approaches to financial risk intelligence in multi-agent crisis simulations.
How does information structure affect crisis decision-making?
We compare two approaches to financial risk intelligence in an agent-based model:
| Approach | Method | Strengths |
|---|---|---|
| FE-EKG (Structured) | Explicit causal chains, SPARQL queries, rule-based risk propagation | High precision, traceability |
| RAG (Unstructured) | Semantic similarity over documents, LLM-based interpretation | Flexibility, coverage |
We study how information quality affects both individual agent decisions and system-level stability by comparing:
- Group A (Insiders): RAG-enabled agents with historical financial context
- Group B (Noise Traders): Uninformed SLM agents prone to hallucination
- H1: RAG-enabled agents make more contextually appropriate decisions across market regimes
- H2: Information asymmetry manifests as differences in decision consistency, risk timing, and survival
- H3: RAG retrieval quality correlates with agent decision quality
┌─────────────────────────────────────────────────────────┐
│ ABM Simulation │
│ ┌─────────────┐ ┌─────────────┐ │
│ │ Group A │ │ Group B │ │
│ │ (RAG) │ │ (No RAG) │ │
│ └──────┬──────┘ └──────┬──────┘ │
│ │ │ │
│ ▼ ▼ │
│ ┌─────────────┐ ┌─────────────┐ │
│ │ Historical │ │ SLM Only │ │
│ │ Context │ │ (Halluci- │ │
│ │ (442K docs) │ │ nation) │ │
│ └─────────────┘ └─────────────┘ │
└─────────────────────────────────────────────────────────┘
Knowledge Graph (FE-EKG) RAG Pipeline
┌─────────────────────┐ ┌─────────────────────┐
│ Risk Layer │ │ ChromaDB │
│ [Liquidity]→[Credit]│ │ 442K chunks │
│ ↑ │ │ BGE embeddings │
│ Event Layer │ │ Reranker │
│ [Default]→[Downgrade│ │ │
│ ↑ │ │ Sources: │
│ Entity Layer │ │ - JPM Weekly │
│ [Lehman]→[Morgan] │ │ - BIS Reports │
└─────────────────────┘ │ - FT Archive │
│ - FCIC Report │
└─────────────────────┘
- Knowledge Graph: AllegroGraph (RDF/SPARQL), 59K triples
- RAG: ChromaDB + BGE embeddings + Reranker
- ABM: Mesa framework
- SLM: Llama 3.2 1B Instruct
- API: Flask + CORS
- Data: 4,000 Capital IQ events (2007-2009 Lehman crisis)
python -m venv venv
source venv/bin/activate
pip install -r requirements.txtCreate .env:
# AllegroGraph
AG_URL=https://your-instance.com/
AG_USER=your_user
AG_PASS=your_password
AG_CATALOG=mycatalog
AG_REPO=FEEKGsource .env && export PYTHONPATH=. && export TOKENIZERS_PARALLELISM=false
python run_experiment.py --liquidity-factor 0.15python api/app.py
# Available at http://localhost:5000├── abm/ # Agent-based model (Mesa)
│ ├── agents.py # BankAgent with use_rag flag
│ └── model.py # CrisisModel simulation
├── rag/ # RAG pipeline
│ ├── retriever.py # ChromaDB retrieval
│ ├── reranker.py # BGE reranker
│ └── evaluation.py # RAG metrics
├── slm/ # Small language model
│ └── llama_client.py
├── evolution/ # 6 event evolution algorithms
├── query/ # SPARQL queries
├── api/ # Flask REST API
├── config/ # Configuration
└── data/ # Capital IQ data
| Parameter | Value |
|---|---|
| Simulation length | 52 weeks |
| Banks | 10 (5 RAG, 5 non-RAG) |
| Initial capital | 100B each |
| Shock week | Week 5 (testing) |
| Pre-shock volatility | 10% |
| Post-shock volatility | 80% |
| Run | Liquidity Factor | Stress Level |
|---|---|---|
| 1 | 0.30 | Mild |
| 2 | 0.20 | Moderate |
| 3 | 0.15 | Significant |
| 4 | 0.10 | Severe |
| Metric | Description |
|---|---|
| Survival Rate | % of each group alive at end |
| Decision Distribution | DEFENSIVE vs MAINTAIN counts |
| Capital Preservation | Final capital comparison |
| Response Quality | Source citations vs hallucinations |
| Source | Files | Coverage |
|---|---|---|
| JPM Weekly (2002-2009) | 366 | Credit, liquidity, market risks |
| BIS Annual (1931-2024) | 94 | Systemic risk, banking stability |
| BIS Quarterly (1997-2024) | 114 | Cross-border risks, derivatives |
| FT Archive | 2,626 | Event-driven risks, sentiment |
| FCIC Report | 1 | Comprehensive crisis analysis |
Total: 3,207 files, 442K chunks
Based on Liu et al. (2024) "Risk identification and management through knowledge Association"
Three-layer structure:
- Entity Layer: 22 financial institutions
- Event Layer: 4,000 events with 6 evolution algorithms
- Risk Layer: Risk types and transitions
Evolution Methods:
- Temporal Correlation (TCDI formula)
- Entity Overlap (Jaccard similarity)
- Semantic Similarity
- Topic Relevance
- Event Type Causality
- Emotional Consistency
| Endpoint | Description |
|---|---|
GET /health |
Health check |
GET /api/entities |
All entities (22) |
GET /api/events |
All events (4,000) |
GET /api/evolution/links |
Evolution relationships |
GET /api/graph/data |
Graph visualization data |
- Phase 3: Inter-bank contagion mechanism
- Phase 4: GraphRAG / KG-GNN hybrid
- Phase 5: Comparative evaluation (KG vs RAG vs Hybrid)
- CLAUDE.md - Developer guide
- docs/PROJECT_OVERVIEW.md - Project overview
- rag/EVALUATION_PLAN.md - RAG evaluation plan
feekg-frontend - Next.js visualization app
Knowledge Graph & Risk Management
- Liu et al. (2024) - "Risk identification and management through knowledge Association: A financial event evolution knowledge graph approach"
Information Asymmetry & Market Microstructure
- Akerlof (1970) - "The Market for Lemons: Quality Uncertainty and the Market Mechanism"
- Grossman & Stiglitz (1980) - "On the Impossibility of Informationally Efficient Markets"
- Kyle (1985) - "Continuous Auctions and Insider Trading"
Financial Contagion & Systemic Risk
- Allen & Gale (2000) - "Financial Contagion"
- Battiston et al. (2012) - "DebtRank: Too Central to Fail?"
- Acemoglu et al. (2015) - "Systemic Risk and Stability in Financial Networks"
Agent-Based Modeling in Finance
- LeBaron (2006) - "Agent-based Computational Finance"
- Farmer & Foley (2009) - "The economy needs agent-based modelling"
- Bookstaber (2017) - "The End of Theory: Financial Crises, the Failure of Economics, and the Sweep of Human Interaction"
2008 Financial Crisis
- Brunnermeier (2009) - "Deciphering the Liquidity and Credit Crunch 2007-2008"
- Financial Crisis Inquiry Commission (2011) - "The Financial Crisis Inquiry Report"
- Gorton (2010) - "Slapped by the Invisible Hand: The Panic of 2007"
RAG & LLM Methodology
- Lewis et al. (2020) - "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks"
- Gao et al. (2023) - "Retrieval-Augmented Generation for Large Language Models: A Survey"
- AllegroGraph - RDF triplestore
- Mesa ABM - Agent-based modeling framework
- ChromaDB - Vector database
- BGE Embeddings - Text embeddings
- Llama 3.2 - Small language model
MIT - Research and educational purposes.
