How AlphaMemo Enables Self‑Evolving Alpha Factor Mining with Structured Search Memory

AlphaMemo introduces a structured‑search‑process memory for LLM agents that records effective and failed edit patterns in specific parent‑factor contexts, uses AST‑difference extraction, confidence‑gated residual learning, and asymmetric veto to tackle combinatorial search, noisy feedback, redundancy, and over‑fitting, achieving superior out‑of‑sample performance and discovery efficiency on CSI 500 and S&P 500 benchmarks.

Bighead's Algorithm Notes
Bighead's Algorithm Notes
Bighead's Algorithm Notes
How AlphaMemo Enables Self‑Evolving Alpha Factor Mining with Structured Search Memory

Background

Alpha factor mining seeks predictive, interpretable signals for future asset returns, typically representing each factor as a symbolic expression over price‑volume variables and selecting high‑quality factors via back‑testing under quality and diversity constraints. The field has progressed from manually designed anomalies to machine‑learning predictors and automatic symbolic search, making it a natural application for LLM agents that can incorporate financial priors, translate hypotheses into formulas, repair invalid expressions, and improve candidates based on numeric feedback.

Problem Definition

Self‑evolving LLM agents for alpha mining face four key challenges:

Combinatorial search space: symbolic search is massive.

Noisy, non‑stationary feedback: difficult to assess factor effectiveness.

Redundant discoveries: many generated factors are duplicates, reducing efficiency.

Over‑fitting risk: naïvely reusing past successful experiences can lead to over‑fitting.

Existing pipelines store feedback only as final factor scores or unstructured histories, which are too coarse for credit assignment and prohibit tracing which local edit caused success or failure. Full trajectory retrieval is prohibitively expensive. A memory mechanism that records which edit patterns succeed or fail within a specific parent‑factor context is needed.

Method

Overall Architecture

AlphaMemo builds on a Structured Search Process Memory (SSPM). At each iteration the agent maintains a retrieval item G_t, a factor pool P_t, and a process memory M_t. It repeatedly selects a parent‑edit action, lets the LLM generator produce a child factor, evaluates the child, updates G_t, and writes the observation to memory.

Parent‑Edit Action Space

The action space consists of pairs (p, m), where p is a parent factor (retrieval item) and m is an edit mode. For each parent p a base search score S_{ledger}(p) is computed. For each possible edit mode m, the memory provides an estimate for the context‑mode pair (z(p), m). The action score is

where Delta_t(z,m) is the posterior mean residual from memory, c_t(z,m) is confidence, and lambda_t is the planned memory weight.

Structured Search Process Memory

SSPM is a confidence‑gated residual memory that records behavior of local edit patterns in a parent‑factor context. For each context‑mode pair (z,m) it stores sufficient statistics: observation count n, mean residual mu, variance sigma^2, and parameters (a^-, b^-) for asymmetric veto of failure posteriors. When evaluating a child factor c, the residual is computed and the entry is updated online. Confidence gating prevents early noisy observations from dominating the search and down‑weights unstable residual estimates. The gating formula is

with kappa controlling the number of observations required for the memory to become active, and lambda_t ensuring the system behaves like pure retrieval in early iterations.

AST‑Difference Extraction

Because LLM‑generated edits are not well captured by manually designed mutation tags, AlphaMemo extracts patterns from the abstract syntax tree (AST) differences between parent and child expressions. Both expressions are parsed with a typed‑operator grammar identical to the evaluator, normalized, and a normalized edit script is computed. Each operation o_i records insertion, deletion, replacement, move, or parameter change on typed nodes. The edit mode m(p,c) is obtained by mapping the normalized edit signature to a compact vocabulary.

Asymmetric Process Veto (APV)

Positive alpha signals are often fragile, while negative search evidence can be more stable. AlphaMemo therefore uses memory asymmetrically: positive residual memory contributes as a soft additive term to the action score, whereas high‑confidence negative patterns can veto an action before generation or admission. The veto rule is

If an action is vetoed, the scheduler selects the next best non‑vetoed action.

Search Loop

Action scoring and selection: score candidate parent‑edit actions (p,m) using the formula above and discard vetoed actions.

Factor generation: prompt the LLM generator with the selected parent, its lineage trace, the expected edit mode, and constraints to generate a child factor.

Factor verification: parse and validate the generated child expression; record invalid attempts as failed observations.

Factor evaluation and admission: evaluate valid child factors during training/validation and admit those that satisfy quality, complexity, and diversity constraints into the factor pool.

State and memory update: add all evaluated child factors to the search ledger and update process memory with observed residuals and states.

Experiments

Experimental Setup

Datasets: CSI 500 (Chinese A‑shares) and S&P 500 (U.S. large‑cap) from Qlib, covering different liquidity, industry composition, and factor stability. Prediction horizon is 20 trading days. Training period 2016‑01‑01 to 2020‑12‑31, validation 2021‑01‑01 to 2021‑12‑31, test/back‑test 2022‑01‑01 to 2025‑12‑26.

Metrics: prediction metrics (IC, ICIR, RankIC, RankICIR), portfolio metrics (annual return, max drawdown, Sharpe), and fixed‑budget discovery efficiency. Effective factors are executable, high‑quality, bounded‑complexity, and non‑redundant expressions.

Baselines: Alpha158, GP, LightGBM, LSTM, AlphaGen, AlphaGPT, AlphaSAGE, AlphaAgent.

Performance Comparison

On S&P 500, AlphaMemo (residual) achieves the best IC, RankIC, RankICIR, annual return, and Sharpe; AlphaGen is slightly stronger on ICIR; Alpha158 yields the smallest drawdown. On CSI 500, AlphaMemo (balanced) attains the strongest results on both prediction and portfolio metrics, demonstrating that a weak residual process memory can improve search without overwhelming the retrieval‑item prior.

Process Memory Calibration

Memory strength is a true control variable, not a monotonic knob. The balanced configuration keeps memory weak enough to retain the retrieval‑item prior while improving CSI 500 metrics. The residual configuration performs strongly on S&P 500 but weaker on CSI 500, indicating that process memory must be calibrated rather than used as an unconditional replacement for search. An APV‑only variant separates negative and positive memory, showing that vetoing reliable failure patterns is useful but less effective than combining it with residual positive evidence.

Sensitivity Study

Varying memory intensity and other hyper‑parameters shows that the effect of process memory depends on when and how strongly it intervenes. The main configuration provides the most balanced performance on both markets, while some variants excel on one market but suffer stability on the other.

Alpha Decay Diagnosis

Annual IC and RankIC are reported for the 2022‑2025 test window to assess temporal stability. Results reaffirm that process memory is not a monotonic knob: APV‑only memory remains relatively stable on CSI 500, while the residual configuration dominates in later test years on S&P 500.

Fixed‑Budget Discovery Diagnosis

On CSI 500, the number of effective factors discovered under a fixed generation budget is measured. Results support the main hypothesis that process memory improves discovery efficiency, provided that confidence control is conservative and credit allocation is residual‑based.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LLMfinancial AIAlpha factor miningAlphaMemoAST diffAsymmetric vetoStructured search memory
Bighead's Algorithm Notes
Written by

Bighead's Algorithm Notes

Focused on AI applications in the fintech sector

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.