[KongchangAI]
· 2 min read· 1,260 words

How Training Data Shapes LLM Rule Internalization

How Training Data Shapes LLM Rule Internalization

Study proposes FSMem framework, revealing that task rule internalization depends on how execution experience is constructed, not on the rules themselves.

This study proposes the FSMem (Finite State Machine Memory) framework, modeling tasks as finite state machines and generating training data via state transitions to systematically examine how data content and organization affect LLM rule internalization. Experiments on synthetic worlds, classic planning, and code execution tasks show that action type diversity dilutes rule learning signals, broader state-action coverage improves rule learning, and single-depth training causes depth specialization; a mixed short-long trajectory corpus surpasses pure long-trajectory training with fewer tokens.

Title

How Training Data Shapes LLM Rule Internalization

Meta Description

FSMem framework investigates how training data shapes rule internalization in LLM parametric memory: how action diversity increases internalization difficulty, how state-action coverage promotes rule learning, and how mixing short and long trajectories surpasses pure long-trajectory training with fewer tokens.

Article Content

The parametric memory of large language models (LLMs) enables them to retain information from past experience and reuse it in subsequent tasks. However, exactly how training data supports the "internalization" of reusable task rules remains an open question. A recent study proposes the FSMem (Finite State Machine Memory) framework, which constructs training data through the lens of state transitions and systematically investigates how data content and organization affect memory formation.

Research Overview

Key Finding: Rule Internalization Is Not Determined by the Rule Alone

The research team evaluated rule reuse capability on synthetic world tasks, classic planning tasks, and code execution tasks, measuring it through metrics such as valid action identification, execution outcome prediction, and next-step operation prediction. The experiments reveal several systematic learning patterns:

  • Under matched training conditions, when task rules must be learned alongside a greater variety of action types, they are harder to internalize even if the rules themselves are unchanged. This means that while action diversity improves coverage, it also increases the difficulty of rule abstraction.
  • Conversely, expanding training data to provide broader state-action coverage generally improves rule learning. This indicates that the impact of data diversity on rule learning is not unidirectional—the key is whether the diversity is reflected in the action space or the state space.
  • Training at only a single execution depth produces "depth specialization" behavior: the model performs best when training and test execution lengths are similar.

These findings collectively point to one conclusion: the same task rules can be internalized to different degrees depending on how execution experience is constructed.

Method: How FSMem Studies Memory Formation

FSMem models tasks as finite state machines and generates training data through state transitions. The advantage of this framework is that it allows researchers to precisely control the content of the data (which rules, which actions) and its organization (trajectory length, coverage), thereby isolating the contributions of different factors to rule internalization.

The study covers three types of scenarios, spanning a task spectrum from synthetic to near-realistic code execution, enhancing the external validity of the conclusions. Evaluation dimensions include valid action identification, execution outcome prediction, and next-step operation prediction in code scenarios, addressing both "identifying the correct action" and "predicting execution consequences."

Finite State Machine (FSM) is an abstract computational model consisting of a finite set of states, transitions between states, and input symbols that trigger transitions. In the FSMem framework, tasks are formalized as follows: each state corresponds to a situation during task execution, actions are input symbols, and state transitions define "the new situation entered after executing an action in the current situation." The key advantage of this modeling approach is that it explicitly expresses task rules as state transition functions, enabling researchers to precisely enumerate and sample "state-action-next state" triples, thereby constructing training data with controllable content and structure. Compared with natural language tasks, FSM formalization sacrifices some expressive richness but gains complete observability of the data generation process—precisely the prerequisite for separating the two types of factors: "rule content" and "experience organization."

Parametric memory refers to a form of memory in which the model encodes information encountered during training into weight parameters, rather than relying on external retrieval or context windows. It is contrasted with non-parametric memory (such as vector stores in retrieval-augmented generation). Parametric memory is characterized by the fact that once information is internalized, it can be reused without additional prompting, but its formation process cannot be directly observed and can only be indirectly inferred through behavioral performance. The "rule internalization" discussed in this paper is essentially whether task rules can be compressed from training data into parametric memory and correctly invoked in new situations.

Implications of Data Organization: Length Mixing Strategy

Building on the "depth specialization" phenomenon, the researchers further constructed a cumulative corpus—mixing short trajectories with long trajectories. Experiments show that this mixed training approach can surpass pure long-trajectory training with fewer training tokens.

This result has direct implications for training data design: simply stacking long trajectories is not the optimal strategy; by mixing execution trajectories of different lengths, the model can be exposed to a richer state-action distribution while avoiding overfitting to a specific execution depth. For tasks that require rule reuse, optimizing data organization may be more effective than simply increasing data volume.

Depth specialization can be analogized to a structural manifestation of overfitting: the model does not memorize wrong answers but instead binds its strategy to the number of execution steps that repeatedly appeared during training. When test trajectory lengths deviate from the training distribution, the model lacks the ability to maintain rule consistency at arbitrary depths. The mechanism of the cumulative corpus strategy is that it makes the same rule appear repeatedly at different trajectory lengths, preventing the model from relying on positional cues about "what to do at step N" and forcing it to learn depth-independent state-action mappings. This is related to but opposite in direction from curriculum learning: curriculum learning typically increases difficulty from easy to hard, whereas length mixing presents different difficulties simultaneously to break dependence on a single depth.

Practical Implications for Training Data Design

This study moves "parametric memory" from an abstract concept to an operational data engineering level. The core insights can be summarized in three points:

  1. Action diversity must be carefully balanced: Increasing action types dilutes the learning signal for a single rule; when designing training data, interference from irrelevant actions on the target rule should be avoided.
  2. State-action coverage is a positive factor: Broader state-action coverage improves rule learning outcomes, contrasting with the negative effect of action diversity, suggesting that "coverage" and "interference" need to be distinguished.
  3. Execution length mixing improves cost-effectiveness: The cumulative corpus strategy improves or maintains performance while reducing token usage, providing a reusable method for constructing efficient training sets.

These findings also offer a new perspective for understanding LLM generalization: the quality of rule internalization depends not only on how frequently a rule appears but also on how the rule is "experienced." Future training data design may need to incorporate state transition structure into consideration, rather than focusing solely on sample quantity and diversity.

One-line Summary

The study proposes the FSMem framework, revealing that the degree of task rule internalization depends on how execution experience is constructed rather than on the rules themselves.

Paragraph Summary

This study proposes the FSMem (Finite State Machine Memory) framework, which models tasks as finite state machines and generates training data through state transitions, systematically examining the impact of data content and organization on LLM rule internalization. Experiments on three types of tasks—synthetic worlds, classic planning, and code execution—show that: increasing action type diversity dilutes the rule learning signal, making rules harder to internalize even when the rules themselves are unchanged; expanding state-action coverage generally improves rule learning; and training at only a single execution depth leads to depth specialization, with the model performing best when training and test lengths are similar. Based on this, the researchers constructed a cumulative corpus mixing short and long trajectories and found that it can surpass pure long-trajectory training with fewer tokens. The study concludes that the quality of rule internalization depends on how rules are "experienced," offering operational engineering insights for training data design.

#LLM rule internalization#FSMem framework#parametric memory#training data design#state-action coverage#depth specialization#finite state machine#curriculum learning
Share:

Related articles