FLAG-TRADER: Fusion LLM-Agent with Gradient-based Reinforcement Learning for Financial Trading

Guojun Xiong, Zhiyang Deng, Keyi Wang, Yupeng Cao, Haohang Li, Yangyang Yu, Xueqing Peng, Mingquan Lin, Kaleb E. Smith, Xiao-Yang Liu, Jimin Huang, Sophia Ananiadou, Qianqian Xie

Abstract

Financial trading requires synthesizing complex, multimodal signals to make sequential decisions in non-stationary environments. While traditional Reinforcement Learning (RL) excels at reward-driven logic, it often lacks the reasoning capabilities of Large Language Models (LLMs). Conversely, LLMs struggle with iterative, goal-oriented tasks. This paper introduces FLAG-TRADER, a framework that fuses a small, RL-tuned LLM (135M parameters) with an actor-critic architecture. By leveraging Parameter-Efficient Fine-Tuning (PEFT) and textual state representations, FLAG-TRADER outperforms massive proprietary models like GPT-4 in multi-step trading tasks, demonstrating that task-specific alignment can outweigh raw parameter scale.

1. Introduction

Financial markets represent a "wicked" decision-making domain characterized by heterogeneous signals—ranging from sequential price data to unstructured sentiment—and shifting regimes. Two dominant AI paradigms have emerged to address these challenges: traditional Reinforcement Learning (RL) and Large Language Models (LLMs). RL is proficient at sequential decision-making but often relies on manually crafted features and struggles with multimodal data. LLMs possess exceptional reasoning and feature extraction capabilities but are primarily designed for static text generation, often failing the iterative logic required for active trading.

FLAG-TRADER (Fusion LLM-Agent with Gradient-based Reinforcement Learning) bridges this gap. It integrates the reasoning power of LLMs with the optimization rigor of RL to create a dynamic agent capable of learning from environmental feedback.

2. Methodology

The core of FLAG-TRADER is a unified actor-critic architecture where a partially fine-tuned LLM serves as the policy network.

2.1 Architecture and PEFT

The framework utilizes SmolLM2-135M-Instruct as the base model. To balance domain-specific adaptation with the preservation of pre-trained knowledge, the authors employ Parameter-Efficient Fine-Tuning (PEFT). As shown in Figure 2, the base layers of the LLM are frozen, while the top layers and specialized Multi-Layer Perceptron (MLP) heads are made trainable. These heads consist of an Actor (Policy head) for action selection and a Critic (Value head) for state-value estimation.

The FLAG-TRADER architecture featuring a frozen LLM base with trainable top layers and specialized Actor-Critic heads.

2.2 Textual State Representation and RL Optimization

Numerical market data, including historical prices and technical indicators (e.g., RSI, MACD), along with account status (cash balance, current positions), are converted into structured text prompts. This allows the LLM to "read" the market state using its pre-trained linguistic reasoning. The agent is trained using Proximal Policy Optimization (PPO), with a reward function based on changes in the Sharpe Ratio to promote risk-adjusted returns.

3. Experimental Setup

The framework was evaluated across six diverse assets: Microsoft (MSFT), Johnson & Johnson (JNJ), UVV Corporation (UVV), Honeywell (HON), Tesla (TSLA), and Bitcoin (BTC). Performance was benchmarked against a standard "Buy & Hold" strategy and INVESTORBENCH, which includes 13 state-of-the-art models such as GPT-4o, GPT-o1-preview, and Llama-3.1-70B.

4. Results and Discussion

FLAG-TRADER demonstrated superior performance across nearly all metrics, particularly in cumulative returns and risk management.

4.1 Performance Analysis

As detailed in Figure 5, FLAG-TRADER achieved a Cumulative Return (CR) of 45.511 on Bitcoin (BTC), significantly outperforming GPT-4 (22.396) and the Buy & Hold strategy (21.821). On Tesla (TSLA), it reached a CR of 50.394, nearly double that of several larger open-source models. On Johnson & Johnson (JNJ), the model achieved a Sharpe Ratio of 3.344, dwarfing the next best open-source model (Yi-1.5-9B at 1.611).

Performance comparison of FLAG-TRADER against proprietary and open-source models on HON, TSLA, and BTC assets.

4.2 Key Insights

The most significant finding is that a 135M parameter model, when aligned via RL for a specific task, can outperform models 500 times its size. This suggests that for specialized domains like finance, task-specific alignment and the integration of reward-driven feedback loops are more critical than raw parameter count. Furthermore, the RL-tuned agent exhibited lower Maximum Drawdowns (MDD) in several scenarios, indicating more stable and robust decision-making compared to standard LLM agents.

5. Conclusion and Future Work

FLAG-TRADER successfully transforms a static LLM into a dynamic trading agent. While the current framework shows immense promise, future work will address computational overhead during RL fine-tuning and sensitivity to prompt formatting. The authors also plan to explore continual learning to adapt to shifting market regimes and the integration of Retrieval-Augmented Generation (RAG) for real-time news processing.

Summary updated

BibTeX
@inproceedings{xiong2025flag,
  author = {Guojun Xiong and Zhiyang Deng and Keyi Wang and Yupeng Cao and Haohang Li and Yangyang Yu and Xueqing Peng and Mingquan Lin and Kaleb E. Smith and Xiao-Yang Liu and Jimin Huang and Sophia Ananiadou and Qianqian Xie},
  title = {{FLAG-TRADER: Fusion LLM-Agent with Gradient-based Reinforcement Learning for Financial Trading}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure