FLAG-Trader: Fusion LLM-Agent with Gradient-based Reinforcement Learning for Financial Trading
FLAG-Trader: Fusion LLM-Agent with Gradient-based Reinforcement Learning for Financial Trading
FLAG-Trader is a novel framework that fuses large language models (LLMs) with gradient-based reinforcement learning (RL) for financial trading. The key innovation is using a partially fine-tuned LLM as the policy network within an actor-critic RL architecture. The LLM is split into frozen base layers (retaining pre-trained knowledge) and trainable top layers (adapted to finance via parameter-efficient fine-tuning). Market states are converted into structured text prompts, enabling the LLM to leverage its language reasoning for decision-making. The policy network outputs trading actions (buy, hold, sell) while a shared value network estimates state values. Both networks are optimized jointly using Proximal Policy Optimization (PPO), with gradients flowing into the trainable LLM layers to align representations with trading rewards.
Extensive experiments show that FLAG-Trader significantly outperforms traditional buy-and-hold strategies and existing LLM-agentic baselines (e.g., FinMem, TradingGPT) in terms of cumulative return and Sharpe ratio. Remarkably, a small 135M-parameter LLaMA model fine-tuned with FLAG-Trader surpasses much larger proprietary models like GPT-4, highlighting the effectiveness of RL-driven fine-tuning. Additionally, the RL fine-tuning improves performance on other financial tasks (e.g., sentiment analysis), demonstrating transferability. The framework balances computational efficiency and domain adaptation by updating only a subset of LLM parameters, making it practical for real-time trading.
Overall, FLAG-Trader provides a unified solution to integrate LLMs' reasoning capabilities with RL's reward-driven optimization, addressing key challenges in financial sequential decision-making such as multimodal data integration, non-stationarity, and manual feature engineering. The results underscore the potential of combining LLMs with RL for robust and efficient financial trading agents.
Highlights
- 1Proposes FLAG-Trader, a unified framework integrating LLMs with gradient-driven RL for financial trading, where a partially fine-tuned LLM acts as the policy network.
- 2Introduces parameter-efficient fine-tuning of LLM layers combined with policy gradient optimization (PPO) to adapt pre-trained knowledge to financial sequential decision-making.
- 3Demonstrates that a small 135M-parameter LLM fine-tuned with FLAG-Trader outperforms larger proprietary models and LLM-agentic baselines in cumulative return and Sharpe ratio.
- 4Validates that RL fine-tuning not only enhances trading performance but also improves results on other financial-domain tasks, showing transferability.
Methods
- MParameter-efficient fine-tuning: Freezes base LLM layers and trains only top layers to retain general knowledge while adapting to finance.
- MActor-critic architecture with shared LLM backbone: Policy network outputs action distribution; value network estimates state value; both use the same frozen and trainable LLM layers.
- MOnline policy gradient learning with PPO: Uses clipped surrogate objective to stabilize updates, with policy loss and value loss jointly optimizing trainable LLM parameters.
- MTextual state representation: Converts numerical market data (price, volume, RSI) and portfolio status into structured prompts for LLM input.
Results
- RFLAG-Trader consistently outperforms buy-and-hold and LLM-agentic baselines (e.g., FinMem, TradingGPT) in cumulative return and Sharpe ratio across multiple stocks.
- RA 135M-parameter LLaMA model fine-tuned with FLAG-Trader surpasses larger models like GPT-4 and FinGPT in trading performance.
- RRL fine-tuning improves LLM performance not only in trading but also on other financial tasks (e.g., sentiment analysis, numerical reasoning), indicating transfer learning benefits.
- RThe framework achieves computational efficiency by updating only a subset of LLM parameters, reducing training cost while maintaining high performance.
Analyze Paper
Generate insights from "FLAG-Trader: Fusion LLM-Agent with Gradient-based Reinforcem...".