How ai4finance-foundation/fingpt works
1. Repository shape
This is a monorepo split into two major worlds: FinGPT, which is a research/training/inference stack for finance-oriented LLMs, and Finogrid, which is a service platform that operationalizes LLM-driven financial workflows. Most of the “apps” are notebook- and script-driven rather than packaged web apps.
2. FinGPT core: model lifecycle
The FinGPT side is organized around the full LLM lifecycle: data preparation, instruction tuning, evaluation/benchmarking, and demo inference. The code is mostly Python, with shell scripts for reproducible runs and notebooks for experimentation. It is centered on lightweight adaptation methods such as LoRA / QLoRA on top of base models like Llama, ChatGLM2, Falcon, MPT, Bloom, and Qwen.
3. Benchmarking subsystem
fingpt/FinGPT_Benchmark is the main task-evaluation layer. It contains dataset download/prepare utilities, task-specific benchmark definitions, and LoRA training entrypoints. The benchmark tasks are financial sentiment, relation extraction, headline classification, NER, QA, and Chinese multiple-choice evaluation. Data flows from benchmark datasets → preprocessing/download scripts → train/eval scripts → task metrics and model comparison.
4. Financial sentiment analysis lineage
fingpt/FinGPT_Sentiment_Analysis_v1 and v3 are earlier/end-to-end sentiment pipelines. They include data preparation, dataset conversion, tokenization, and fine-tuning paths for Chinese and English financial sentiment. These directories show the repository’s progression from dataset construction to model training to benchmark reporting.
5. Forecasting subsystem
fingpt/FinGPT_Forecaster is a separate application track focused on stock movement prediction and robo-advice. Its pipeline combines market data, news, indices, sentiment, and prompts; the main Python modules (data_pipeline.py, market_sentiment.py, indices.py, prompt.py, app.py) indicate a preprocessing-to-prediction flow. This area also has a Chinese variant and notebook-based training/inference artifacts. The README makes clear this subsystem can run with local FinGPT models or external cloud LLMs.
6. RAG and retrieval-based sentiment
fingpt/FinGPT_RAG contains two distinct parts: instruct-FinGPT for supervised fine-tuning/inference, and multisource_retrieval for retrieval-augmented sentiment analysis. The retrieval pipeline scrapes multiple news sources, normalizes and splits text, classifies sources, and optionally uses external LLM providers. This is the main boundary where data collection, retrieval, and LLM inference are combined into a context-enriched sentiment system.
7. Financial report analysis
fingpt/FinGPT_FinancialReportAnalysis is a smaller but separate RAG-style workflow for earnings calls and PDF/report processing. Utilities for PDF formatting, earnings-call handling, and retrieval indicate a pipeline from unstructured financial documents to summarized or question-answering outputs.
8. Multi-agent and evaluation experiments
fingpt/FinGPT_MultiAgentsRAG groups multi-agent retrieval experiments, fine-tuning notebooks, and evaluation suites such as MMLU, TruthfulQA, and HaluEval. Architecturally, this is an experimentation layer that compares multi-agent reasoning against RAG and tuned models, rather than a production service.
9. “Other” application demos
fingpt/FinGPT_Others holds application prototypes such as robo-advisors, trading assistants, and low-code development examples. These are downstream consumers of the same LLM/data primitives used elsewhere in the repo, but they are not a single shared runtime; they are mostly notebook-driven demos with their own datasets and helper scripts.
10. Finogrid platform: operational layer
finogrid/ is the production-oriented platform. It is split into service APIs, domain logic, database schema/models, corridor adapters, MCP integrations, and a TypeScript SDK. This part is more explicitly service-oriented and is where FinGPT capabilities are embedded into a larger orchestration system.
11. Finogrid request/data flow
The Finogrid service layer suggests a pipeline like: ingress API receives requests, routing engine selects execution paths, partner execution sends work outward, reconciliation closes the loop, and agent-ledger services record accounting/payment state. ops_console provides operator-facing views over approvals, corridors, exceptions, mandates, and ledger data. agent_ledger_api handles wallet/payment/top-up/KYA/micropay concerns, while middleware such as payment gating sits in front of protected operations.
12. Corridors and external integrations
finogrid/corridors contains country-specific adapters (Argentina, Brazil, India, Indonesia, Nigeria, Philippines, UAE, Vietnam) built on a shared base interface. finogrid/mcp contains connector-style servers for bridge, identity, KYA/KYT, Plaid, and wallet factory, which are the platform’s external-service boundaries. This is the integration layer for banking/compliance/identity and other regulated financial infrastructure.
13. FinGPT integration inside Finogrid
finogrid/fingpt_integration is the bridge from platform services to LLM capabilities: sentiment, forecaster, and RAG modules. It also includes provider selection and fallback logic for cloud LLMs such as MiniMax or OpenAI versus local FinGPT models. This boundary is important architecturally: platform services depend on a pluggable LLM provider interface rather than a single model backend.
14. Persistence, SDK, and tooling
Finogrid persists operational state through SQL migrations and Python ORM-style models under database/. The TypeScript SDK under sdk/typescript exposes the platform to external clients. Across the repo, notebooks, shell scripts, config JSON, and requirements files are the main orchestration/tooling mechanism, showing that reproducibility and experimentation are first-class concerns alongside service deployment.
Main entry points: fingpt FinGPT · fingpt_integration FinGPT Bridge · database Database · FinGPT_Benchmark Benchmarking
Components 21
FinGPT
Research, training, evaluation, and demo workflows for finance-oriented LLMs.
- FinGPT · Top-level FinGPT workspace for model lifecycle experiments and finance applications.
fingpt - Benchmarking · Dataset prep, benchmark definitions, LoRA training, and evaluation for finance tasks.
fingpt/FinGPT_Benchmark - Sentiment v1 · Early end-to-end sentiment workflow with data preparation, dataset construction, and training.
fingpt/FinGPT_Sentiment_Analysis_v1 - Sentiment v3 · Later sentiment stack with benchmark notebooks and quantized training variants.
fingpt/FinGPT_Sentiment_Analysis_v3 - Forecaster · Stock movement prediction and robo-advice pipeline from market/news inputs to prompts and inference.
fingpt/FinGPT_Forecaster - RAG Sentiment · Instruction tuning plus multi-source retrieval-augmented sentiment analysis.
fingpt/FinGPT_RAG - Report Analysis · Earnings-call and PDF/report processing for summarization and Q&A.
fingpt/FinGPT_FinancialReportAnalysis - Multi-Agents · Multi-agent retrieval experiments and evaluation against benchmark suites.
fingpt/FinGPT_MultiAgentsRAG - Other Demos · Notebook-driven robo-advisor, trading, and low-code prototypes built on shared LLM primitives.
fingpt/FinGPT_Others
Finogrid
Operational platform for LLM-driven financial workflows, integrations, and ledgers.
- Finogrid · Production-oriented service platform for routing, execution, compliance, and ledger state.
finogrid - Ingress API · Public entrypoint for onboarding, batch submission, and webhook traffic.
finogrid/services/ingress_api - Routing Engine · Selects execution paths and coordinates routing workers.
finogrid/services/routing_engine - Partner Exec · Dispatches work to external partners and bridge clients.
finogrid/services/partner_execution - Reconciliation · Closes the loop by reconciling execution results and operational state.
finogrid/services/reconciliation - Agent Ledger · Wallet, micropay, top-up, and KYA/KYT services with payment gating.
finogrid/services/agent_ledger_api - Ops Console · Operator-facing views for approvals, corridors, exceptions, mandates, and ledger exploration.
finogrid/services/ops_console - Corridors · Country-specific corridor adapters over a shared base interface.
finogrid/corridors - MCP Integrations · Connector-style servers for identity, KYA/KYT, plaid, bridge, and wallet factory.
finogrid/mcp - FinGPT Bridge · Pluggable FinGPT/cloud LLM provider boundary for sentiment, forecaster, and RAG features.
finogrid/fingpt_integration - Database · SQL migrations and domain models for routing, execution, mandates, audits, and ledgers.
finogrid/database - TypeScript SDK · External client SDK for platform access and typed integration.
finogrid/sdk/typescript
Connections 27
- FinGPT → Benchmarking: organizes · The repo groups benchmark training and evaluation under FinGPT.
- FinGPT → Sentiment v1: contains · Early sentiment pipeline lives within the FinGPT research stack.
- FinGPT → Sentiment v3: contains · Later sentiment iteration extends the same research line.
- FinGPT → Forecaster: contains · Forecasting and robo-advice are a separate FinGPT application track.
- FinGPT → RAG Sentiment: contains · Retrieval-augmented sentiment and instruction tuning are grouped together.
- FinGPT → Report Analysis: contains · Financial report analysis is a smaller RAG workflow.
- FinGPT → Multi-Agents: contains · Multi-agent RAG experiments and evaluations live here.
- FinGPT → Other Demos: contains · Miscellaneous downstream demos share the same LLM primitives.
- Benchmarking → Sentiment v1: evolves from · Sentiment pipeline history feeds into benchmarked task framing.
- Sentiment v1 → Sentiment v3: iterates to · Version 3 continues the sentiment line with newer training/benchmarking.
- Benchmarking → RAG Sentiment: shares tasks · Benchmark tasks overlap with instruction-tuned and retrieval-based sentiment workflows.
- Forecaster → FinGPT Bridge: uses · Forecasting can run on local FinGPT models through the platform bridge.
- RAG Sentiment → FinGPT Bridge: feeds · Retrieval and sentiment workflows can use the platform LLM bridge.
- Report Analysis → FinGPT Bridge: feeds · Document analysis can reuse the shared LLM integration boundary.
- Finogrid → Ingress API: exposes · Ingress API is the front door for platform requests.
- Ingress API → Routing Engine: dispatches · Incoming work is routed into execution paths.
- Routing Engine → Partner Exec: routes · Selected jobs are sent to partner execution.
- Partner Exec → Reconciliation: returns · Execution outcomes are reconciled back into platform state.
- Ingress API → Agent Ledger: authorizes · Protected requests depend on payment and wallet state.
- Agent Ledger → Database: persists · Ledger and wallet state are stored in the operational database.
- Routing Engine → Database: reads/writes · Routing decisions and execution metadata are persisted.
- Reconciliation → Database: updates · Reconciliation closes execution records and related state.
- Ops Console → Database: observes · Operator views inspect approvals, corridors, mandates, and ledger data.
- Corridors → MCP Integrations: integrates · Country adapters rely on external compliance and banking connectors.
- FinGPT Bridge → TypeScript SDK: exposes · Platform capabilities are surfaced to external clients through the SDK boundary.
- FinGPT Bridge → Database: consumes state · LLM-enabled platform features may read persisted operational context.
- Ops Console → Agent Ledger: oversees · Ops console provides oversight on wallet, micropay, and KYA flows.