Fin-RSI: A Unified Library of Financial Skills, Checks, and Self-Improvement for LLM Agents

Wanghao Ye, Shwai He, Sihan Chen, Yiting Wang, Bowei Tian, Guoheng Sun, Ziyi Wang, Ziyao Wang, Yexiao He, Zheyu Shen, Meng Liu, Yuning Zhang, Meng Feng, Yifei Dong, Yanhong Qian, Yang Wang, Siyuan Peng, Yilong Dai, Zhenle Duan, Joshua Liu, Lang Xiong, Aarosh Das, Zhaoyi Liu, Daeun Jung, Aditya Sarkar, Parastoo Pilevar, Xiaochuan Gong, Yancheng Zhu, Yingying Fan, Qiong Wang, Ang LiarXiv 2026

TL;DR

Financial software is a fragmented mess of different libraries and conventions, making it a minefield for AI agents. Fin-RSI solves this by providing a unified "toolbox" of 131 financial skills, 39 automated checks to catch common trading blunders, and 7 self-improvement loops that help agents fix their own code. By giving models a way to discover the right tools and learn from their mistakes, the researchers saw valid program generation for large models leap from a measly 24% to nearly 65%.

What Problem Does This Paper Address?

Building an AI agent to trade stocks sounds simple until you hit the "Amazon Problem." In June 2022, Amazon had a 20-for-1 stock split. To a naive algorithm looking at raw price data, it looked like the company’s value plummeted by 95% in a single day. An agent without context would immediately short the stock, losing a fortune on a data glitch.

This is the core challenge: financial data is full of "conventions"—things like stock splits, look-ahead bias (accidentally using future data to predict the past), and specific timing rules. Currently, financial software is scattered across dozens of libraries with inconsistent interfaces. For an LLM agent, finding the right function and using it correctly is like trying to build a car using a manual written in five different languages with missing pages.

Methods

The authors introduce Fin-RSI (Recursive Self-Improvement), a Python library designed to be a "middleman" between the LLM and the messy world of finance. It consists of three main pillars:

  1. Skills (The Toolbox): 131 standardized documents and 48 tested algorithms. The standout feature here is the route() function. Instead of the agent guessing a function name, it describes what it wants to do in plain English, and route() finds the matching implementation.
  2. Checks (The Guards): 39 automated "property checks." These don't just check if the code runs; they check if it makes sense. For example, a check might verify that a strategy doesn't "trade on the close"—meaning it doesn't try to buy a stock at 4:00 PM using information that wasn't available until 4:01 PM.
  3. Self-Improvement (The Tutor): If an agent’s code fails a check, Fin-RSI doesn't just throw an error. It provides "rule cards"—explanations of why the code failed (e.g., "You forgot to adjust for the stock split"). The agent can then use one of seven built-in methods (like Reflexion or CheckFeedback) to iterate and fix the program.
Figure 1: Fin-RSI at a glance. Left: the library, one piece per skill, rule card, check and self-improvement method; coloured pieces illustrate a selection. Middle: the agent is the user’s own model plus the pieces it picks or that route() names, used through MCP, tool schemas or Python. Right: a stock-strategy backtest illustrates buying and selling on historical prices and tracking returns; the curves are schematic. The agent writes a program and the checks run; a failure goes to the self-improvement method before the next attempt, within one budget for every method. Only the delivered program meets the hidden grader. The benchmark retains valid, accepted-but-wrong and rejected episodes. Appendix Figure 4 follows one episode.

Datasets

To test this, the researchers created a benchmark of 34 financial programming tasks across five families (Portfolio, Signal, Volatility, Risk, and Forecast).

  • Synthetic Data: They used generated "Gaussian" returns to test algorithms in a controlled environment.
  • Real-World Data: They specifically included a "real panel" featuring the as-traded prices of four stocks (including Amazon) that underwent splits in 2022 to see if agents could handle the "Amazon Problem" described earlier.
  • The Hidden Grader: Unlike many benchmarks where the model sees the answer, this uses a "hidden grader" that compares the agent's output to an independent reference only after the agent has finished its self-improvement cycles.

Key Insights and Ideas

  • Discovery is the Bottleneck: The biggest jump in performance didn't come from the models getting "smarter" at coding, but from them getting better at finding the right tool. When models used the route() function to find a library call instead of writing the logic from scratch, their success rate skyrocketed.
  • The 14B Threshold: There is a clear "intelligence floor." Models with fewer than 14 billion parameters struggled to use the library effectively. However, for models 14B and larger, the library was a massive force multiplier.
  • Feedback Needs Context: Simply telling a model "your code failed" isn't very helpful. Providing a "rule card" that explains the financial logic behind the failure allowed models to fix errors that they previously ignored.
Figure 2: Who gains from the library: valid episodes without it (F0), with its interface (F1), with route() (F4), or with the call named (F2). (a) Model-size groups: finding the call helps more than listing the interface (dashed: F0; line across F4: F2). (b) Every model, grouped by series and size in billions (shaded: 14B or more); F4 and F2 differ by at most 2 episodes per model. (c) Every rule and both variants: F2 and F4 beat F0 and F1 (grey dots: F1, F3).

Key Results

The impact of the library was measured across 20 different open-weight models:

  • Overall Success: Without the library, only 9.7% of episodes produced a valid, working program. With Fin-RSI’s tool discovery, that rose to 29.2%.
  • Large Model Gains: For models with at least 14 billion parameters, the success rate jumped from 23.6% to 64.6%.
  • Error Reduction: The library was particularly good at catching "timing errors" (like trading on data you shouldn't have yet). Without the library, 258 programs made these errors; with the library's checks and feedback, that number dropped to just 33.
A visual example of a one-line error being caught by a split-adjustment check and subsequently repaired by the agent.

Limitations and Future Work

While impressive, the study currently focuses on position rules (deciding how much of a stock to hold) and tests open-weight models up to 32B parameters. The authors acknowledge that as financial agents evolve, they will need to expand the library to cover more complex tasks like high-frequency trading or multi-agent negotiations. They also plan to expand the "skill" coverage as the community contributes new financial tools to the unified interface.

Summary updated

Abstract

As large language models (LLMs) become more capable, financial agents need tools they can readily discover and use. Yet financial software is fragmented across libraries with different interfaces and conventions, making it difficult to build reliable agent workflows. We present Fin-RSI, a unified Python library of financial skills, checks, and self-improvement designed for LLM agents. It brings together tools for market analysis, forecasting, portfolio construction, and trading research through shared interfaces across models and agent frameworks. Agents can find suitable tools from natural-language requests, reuse tested implementations, and improve generated programs through checking and feedback. Developers can extend the library with new tools without rebuilding integrations for each model. Across 20 open-weight models on six trading-position tasks, tool discovery increased the proportion of episodes producing valid programs from 9.7% to 29.2%; for models with at least 14 billion parameters, it rose from 23.6% to 64.6%. We release the library and benchmark as a shared resource for the community and plan to expand its tools and task coverage as financial agents evolve.
BibTeX
@misc{ye2026fin,
  author = {Wanghao Ye and Shwai He and Sihan Chen and Yiting Wang and Bowei Tian and Guoheng Sun and Ziyi Wang and Ziyao Wang and Yexiao He and Zheyu Shen and Meng Liu and Yuning Zhang and Meng Feng and Yifei Dong and Yanhong Qian and Yang Wang and Siyuan Peng and Yilong Dai and Zhenle Duan and Joshua Liu and Lang Xiong and Aarosh Das and Zhaoyi Liu and Daeun Jung and Aditya Sarkar and Parastoo Pilevar and Xiaochuan Gong and Yancheng Zhu and Yingying Fan and Qiong Wang and Ang Li},
  title = {{Fin-RSI: A Unified Library of Financial Skills, Checks, and Self-Improvement for LLM Agents}},
  year = {2026},
  eprint = {2611.29716},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.29716},
}
Figure