我的征尘是星辰大海。。。
The dirt and dust from my pilgrimage forms oceans of stars...
-------当记忆的篇章变得零碎,当追忆的图片变得模糊,我们只能求助于数字存储的永恒的回忆
作者:黄教授
手机视频列表
从状态机到幂级数
视频
音频
原始脚本
从状态机到密集数,结构化推理任务的小模型优化范式,在大模型以千亿参数为标尺的时代,三星 AI 实验室7M参数递归小模型,TRM,击败千亿级大语言模型,LLM 的案例揭示了一个被忽视的核心逻辑。 结构化推理任务的本质并非参数堆砌,而是对任务数学规律的精准捕捉。 本文将系统梳理状态机、递归函数、泰勒展开的优化思路,论证为何数独、迷宫、语法解析等任务无需依赖大模型,仅用一维小参数模型即可实现高效求解,甚至具备通用化潜力。 一、核心前提。 结构化任务的本质是可数学化的状态机,数独、迷宫、棋类博弈、语法解析等任务,看似形态各异,实则共享一个底层属性,可建模为带约束的状态机。 状态机的核心要素可概括为三点固定不变的输入问题,如9×9数独题目、迷宫地图、C 加加代码文本,构成任务的初始边界。 动态更新的当前状态,如部分填充的数独网格、迷宫中的当前位置、语法解析的中间符号栈,是递归迭代的核心载体。 明确刚性的约束规则,如数独行列宫不重复、迷宫不可穿墙、语法括号成对匹配、定义状态转移的合法路径。 这类任务的目标本质是从初始状态出发,通过合法状态转移抵达满足约束的终止状态。 其核心特征在于规则明确、目标唯一、状态转移可量化,完全区别于自然语言任务的语义模糊性和场景多样性。 这为后续的数学建模和参数简化提供了基础。 二、关键桥梁,状态机到递归函数的转化状态机的迭代过程,天然对应递归函数的数学表达。 按照上一轮输出作为下一轮输入的递归定义,结构化任务的求解过程可抽象为通用递归函数。 F S X R 等于 S,输入上一轮状态 S,如第 N 步的数独网格,原始问题 X,固定不变,约束规则 二、隐含参数。 输出下一轮优化状态 S,如 DN 加一步填充后的数独网格。 迭代逻辑,基于约束二,分析当前状态 S 与目标状态的差距,如空白格数量、违反规则次数,生成最优转移路径,得到更接近目标的 S。 终止条件, S 次满足所有约束,如数独填满且无重复,即抵达终止状态 S 下划线 final。 以数独解题为例,递归过程可具象化为 S,空白题目,F,X,R,S,填充一个候选唯一格,F,S。 XRS2,再填充一个候选唯一格 SK,完整正确数独。 这种逐步优化的递归逻辑,无需记忆所有可能的解,仅需聚焦当前状态的局部最优转移,为参数精简埋下伏笔。 三、优化核心,开了展开实现参数的降维打击,传统大模型求解结构化任务的思路是 是用千亿参数的高维矩阵暴力拟合所有可能的状态转移路径,相当于不知道曲线方程,却用海量离散点拼出曲线形状,冗余度极高。 而我们的核心优化思路,是用泰勒展开,幂级数逼近,替代高维拟合,实现参数从千亿维矩阵到一维 系数向量的质变。 一、递归函数的可导性,基础结构化任务的递归函数 FS,具备天然的可导性。 其核心目标是最小化误差函数 ES,如违反约束的次数与目标状态的距离,而 ES 的变化的过程是连续且平 滑的。 例如,数独解题中,每填充一个正确数字,误差 ES会确定性下降。 迷宫探索中,每向出口靠近一步,距离误差会单调递减。 这种误差平滑递减的特性确保递归函数 FS满足泰勒定理的应用条件,在终止状态 S,Fano附近,可展开为低次幂级数。 2泰勒展开的参数简化逻辑,根据泰勒定理,可导函数 f s 在 s final 附近的逼近公式为 A F S 约等于 A 加 A,括号 S 减 S final,加 A 二 S 减 S final 平方,加加 A S 减 S final K。 其中 A 等于 F,S final,终止状态的自映射,常数 A 等于 F。 S final,误差下降速率常数 A 二等于 FS FINAL 2,速率、变化率、常数,K为幂级数的最高次数。 关键在于结构化任务的约束规则是硬逻辑,误差下降规律极其简洁,仅需前3~5项低次幂即可实现高精度逼近,无需高次项。 此时模型参数不再 不再是大模型的高维矩阵,而是泰勒展开的一维系数向量。 A、 A 1A、2A。 参数规模从千亿级骤降至个位数、十位数级。 这正是 TRM 仅用7M参数就能击败千亿 LLM 的核心原理。 三、工程化优势,低次幂即可满足精度需求。 从工程实践角度,结构化任务的规律确定性强。 无需高次幂级数即可拟合。 例如,数独解题中,仅需前三项 A A A 2,就能精准描述候选及筛选、数字填充、误差修正的循环。 迷宫探索中,前两项 A A 即可表达向出口方向移动到避开障碍的核心逻辑。 这种低次幂逼近的特性让模型不仅参数极少,且推理速度极快,无需大模型的海量矩阵运算,仅需简单的幂次计算和系数加权,边缘设备即可部署。 四、拓展潜力。 从任务专用到通用结构化推理模型,当前 TRM 等小模型仍局限于单一任务,如数独、迷宫。 但基于本文思路,可进一步构建通用结构化推理小模型。 其核心逻辑在于,所有结构化任务共享状态机、加递归函数、加可导误差的底层框架,仅需统一状态表征和约束规则的数学编码即可用同一个泰勒展开模型适配多任务。 例如状态表征统一,将数独网格、迷宫地图、语法符号占均编码为向量型状态。 约束规则编码,将数独不重复、迷宫不穿墙、语法括号匹配,均转化为统一的误差计算函数。 模型参数共享,泰勒展开的系数向量 A A A 2,可通过多任务训练,同时训练数独、迷宫、语法解析,习得通用规律,无需为每个任务单独设计模型。 这种通用小模型可作为逻辑分析器或高效 搜索器广泛应用于形式化推理任务、几何证明、逻辑演绎、结构化数据处理、表格填充、规则校验、程序语言工具、语法解析、代码调试、博弈类任务、棋类对弈、路径规划。 其效率优势远超大模型,推理速度提升百倍以上,部署成本降低万倍,且准确率更高。 五大模型的幻觉问题,结果可通过约束规则验证。 5、结论。 回归任务本质,拒绝参数迷信大模型的参数竞赛,并非所有任务的最优解。 对于结构化推理任务,我们无需追求千亿参数的暴力拟合,而应回归任务的数学本质。 一、识别任务的状态及属性,明确输入状态与约束。 二、将状态转移转化为可导的递归函数。 三、用低次泰勒展开逼近函数,用一维系数向量替代高维矩阵。 这种思路下的小模型不仅参数极少、效率极高,更具备通用化潜力,可为结构化推理领域提供全新的优化范式。 正如爱因斯坦所言,把事情变复杂很简单,把事情变简单很复杂。 放弃对参数规模的迷信,深入挖掘任务的数学规律,或许才是 AI 高效求解特定领域问题的未来方向。
修正脚本
从状态机到幂级数,结构化推理任务的小模型优化范式,在大模型以千亿参数为标尺的时代,三星 AI 实验室7M参数递归小模型,TRM,击败千亿级大语言模型,LLM 的案例揭示了一个被忽视的核心逻辑。 结构化推理任务的本质并非参数堆砌,而是对任务数学规律的精准捕捉。 本文将系统梳理状态机、递归函数、泰勒展开的优化思路,论证为何数独、迷宫、语法解析等任务无需依赖大模型,仅用一维小参数模型即可实现高效求解,甚至具备通用化潜力。 一、核心前提。 结构化任务的本质是可数学化的状态机,数独、迷宫、棋类博弈、语法解析等任务,看似形态各异,实则共享一个底层属性,可建模为带约束的状态机。 状态机的核心要素可概括为三点:固定不变的输入问题,如9×9数独题目、迷宫地图、C++代码文本,构成任务的初始边界。 动态更新的当前状态,如部分填充的数独网格、迷宫中的当前位置、语法解析的中间符号栈,是递归迭代的核心载体。 明确刚性的约束规则,如数独行列宫不重复、迷宫不可穿墙、语法括号成对匹配,定义状态转移的合法路径。 这类任务的目标本质是从初始状态出发,通过合法状态转移抵达满足约束的终止状态。 其核心特征在于规则明确、目标唯一、状态转移可量化,完全区别于自然语言任务的语义模糊性和场景多样性。 这为后续的数学建模和参数简化提供了基础。 二、关键桥梁,状态机到递归函数的转化:状态机的迭代过程,天然对应递归函数的数学表达。 按照上一轮输出作为下一轮输入的递归定义,结构化任务的求解过程可抽象为通用递归函数。 F S X R 等于 S,输入上一轮状态 S,如第 N 步的数独网格,原始问题 X,固定不变,约束规则R,隐含参数。 输出下一轮优化状态 S,如 D_N 加一步填充后的数独网格。 迭代逻辑,基于约束R,分析当前状态 S 与目标状态的差距,如空白格数量、违反规则次数,生成最优转移路径,得到更接近目标的 S。 终止条件, S 已满足所有约束,如数独填满且无重复,即抵达终止状态 S 下划线 final。 以数独解题为例,递归过程可具象化为 S₀=空白题目,F(S₀,X,R)=S₁,填充一个候选唯一格,F(S₁,X,R)=S₂,再填充一个候选唯一格...S_K,完整正确数独。 这种逐步优化的递归逻辑,无需记忆所有可能的解,仅需聚焦当前状态的局部最优转移,为参数精简埋下伏笔。 三、优化核心,泰勒展开实现参数的降维打击,传统大模型求解结构化任务的思路是用千亿参数的高维矩阵暴力拟合所有可能的状态转移路径,相当于不知道曲线方程,却用海量离散点拼出曲线形状,冗余度极高。 而我们的核心优化思路,是用泰勒展开,幂级数逼近,替代高维拟合,实现参数从千亿维矩阵到一维系数向量的质变。 一、递归函数的可导性,基础结构化任务的递归函数 FS,具备天然的可导性。 其核心目标是最小化误差函数 ES,如违反约束的次数与目标状态的距离,而 ES 的变化的过程是连续且平滑的。 例如,数独解题中,每填充一个正确数字,误差 ES会确定性下降。 迷宫探索中,每向出口靠近一步,距离误差会单调递减。 这种误差平滑递减的特性确保递归函数 FS满足泰勒定理的应用条件,在终止状态S_final附近,可展开为低次幂级数。 二、泰勒展开的参数简化逻辑,根据泰勒定理,可导函数 f s 在 s final 附近的逼近公式为 F S 约等于 A₀ 加 A₁(S 减 S final) 加 A₂(S 减 S final)平方 加…加A_K(S 减 S final)^K。 其中 A₀ 等于 F(S final),终止状态的自映射,常数;A₁等于F'(S final),误差下降速率常数;A₂等于F''(S final),速率的变化率常数,K为幂级数的最高次数。 关键在于结构化任务的约束规则是硬逻辑,误差下降规律极其简洁,仅需前3~5项低次幂即可实现高精度逼近,无需高次项。 此时模型参数不再是大模型的高维矩阵,而是泰勒展开的一维系数向量A₀、A₁、A₂…A_K。 参数规模从千亿级骤降至个位数、十位数级。 这正是 TRM 仅用7M参数就能击败千亿 LLM 的核心原理。 四、工程化优势,低次幂即可满足精度需求。 从工程实践角度,结构化任务的规律确定性强。 无需高次幂级数即可拟合。 例如,数独解题中,仅需前三项 A₀ A₁ A 2,就能精准描述候选数筛选、数字填充、误差修正的循环。 迷宫探索中,前两项 A₀ A₁ 即可表达向出口方向移动并避开障碍的核心逻辑。 这种低次幂逼近的特性让模型不仅参数极少,且推理速度极快,无需大模型的海量矩阵运算,仅需简单的幂次计算和系数加权,边缘设备即可部署。 五、拓展潜力。 从任务专用到通用结构化推理模型,当前 TRM 等小模型仍局限于单一任务,如数独、迷宫。 但基于本文思路,可进一步构建通用结构化推理小模型。 其核心逻辑在于,所有结构化任务共享状态机、加递归函数、加可导误差的底层框架,仅需统一状态表征和约束规则的数学编码即可用同一个泰勒展开模型适配多任务。 例如状态表征统一,将数独网格、迷宫地图、语法符号栈均编码为向量型状态。 约束规则编码,将数独不重复、迷宫不穿墙、语法括号匹配,均转化为统一的误差计算函数。 模型参数共享,泰勒展开的系数向量 A₀ A₁ A 2,可通过多任务训练,同时训练数独、迷宫、语法解析,习得通用规律,无需为每个任务单独设计模型。 这种通用小模型可作为逻辑分析器或高效搜索器广泛应用于形式化推理任务、几何证明、逻辑演绎、结构化数据处理、表格填充、规则校验、程序语言工具、语法解析、代码调试、博弈类任务、棋类对弈、路径规划。 其效率优势远超大模型,推理速度提升百倍以上,部署成本降低万倍,且准确率更高,无大模型的幻觉问题,结果可通过约束规则验证。 五、结论。 回归任务本质,拒绝参数迷信大模型的参数竞赛,并非所有任务的最优解。 对于结构化推理任务,我们无需追求千亿参数的暴力拟合,而应回归任务的数学本质。 一、识别任务的状态及属性,明确输入状态与约束。 二、将状态转移转化为可导的递归函数。 三、用低次泰勒展开逼近函数,用一维系数向量替代高维矩阵。 这种思路下的小模型不仅参数极少、效率极高,更具备通用化潜力,可为结构化推理领域提供全新的优化范式。 正如爱因斯坦所言,把事情变复杂很简单,把事情变简单很复杂。 放弃对参数规模的迷信,深入挖掘任务的数学规律,或许才是 AI 高效求解特定领域问题的未来方向。
英文翻译
From state machines to power series: the optimization paradigm for small models in structured reasoning tasks. In the era of large models with hundreds of billions of parameters as the benchmark, the case of Samsung AI Lab’s 7M-parameter recursive small model, TRM, defeating a hundred-billion-parameter large language model (LLM) reveals a neglected core logic. The essence of structured reasoning tasks is not the stacking of parameters, but the precise capture of the mathematical laws of the task. This article systematically reviews the optimization ideas of state machines, recursive functions, and Taylor expansions, arguing why tasks such as Sudoku, mazes, and grammar parsing do not need to rely on large models, and can be solved efficiently with only one-dimensional small-parameter models, even possessing generalization potential. 1. Core Premise. The essence of structured tasks is a mathematizable state machine. Tasks such as Sudoku, mazes, board game playing, and grammar parsing, though seemingly diverse in form, share a common underlying attribute: they can be modeled as constrained state machines. The core elements of a state machine can be summarized in three points: a fixed, unchanging input problem (e.g., a 9×9 Sudoku puzzle, a maze map, or C++ code text), which defines the initial boundary of the task; a dynamically updated current state (e.g., a partially filled Sudoku grid, the current position in a maze, or an intermediate symbol stack in grammar parsing), which serves as the core carrier of recursion; and clear, rigid constraint rules (e.g., no repeats in Sudoku rows, columns, and blocks; no walking through walls in a maze; paired matching of parentheses in grammar), which define the legal paths of state transitions. The goal of such tasks is essentially to start from an initial state and reach a terminal state that satisfies all constraints through legal state transitions. Their core characteristics are clear rules, a unique goal, and quantifiable state transitions, completely different from the semantic ambiguity and scenario diversity of natural language tasks. This provides a foundation for subsequent mathematical modeling and parameter simplification. 2. Key Bridge: Transformation from State Machine to Recursive Function. The iterative process of a state machine naturally corresponds to the mathematical expression of a recursive function. Following the recursive definition that the output of the previous round serves as the input of the next round, the solution process of a structured task can be abstracted into a general recursive function: F(S, X, R) = S'. Input: the previous round's state S (e.g., the Sudoku grid at step N), the original problem X (fixed), and the constraint rules R (implicit parameters). Output: the next round's optimized state S' (e.g., the Sudoku grid after filling in one more step at D_N+1). Iteration logic: based on constraints R, analyze the gap between the current state S and the target state (e.g., number of empty cells, number of rule violations), generate the optimal transition path, and obtain S' that is closer to the target. Termination condition: S already satisfies all constraints (e.g., Sudoku is fully filled with no repeats), i.e., reaches the terminal state S_final. Taking Sudoku solving as an example, the recursive process can be concretized as: S₀ = initial blank puzzle; F(S₀, X, R) = S₁ (fill in a unique candidate cell); F(S₁, X, R) = S₂ (fill in another unique candidate cell); ... S_K = complete correct Sudoku. This stepwise optimization recursion logic does not need to remember all possible solutions; it only needs to focus on the local optimal transition of the current state, laying the groundwork for parameter simplification. 3. Optimization Core: Taylor Expansion Achieves Dimensionality Reduction of Parameters. The traditional large model approach to solving structured tasks uses high-dimensional matrices with hundreds of billions of parameters to brute-force fit all possible state transition paths. This is equivalent to not knowing the curve equation but using a massive number of discrete points to piece together the curve shape—extremely redundant. Our core optimization idea is to use Taylor expansion (power series approximation) to replace high-dimensional fitting, achieving a qualitative change in parameters from a billion-dimensional matrix to a one-dimensional coefficient vector. (a) Differentiability of the recursive function. The recursive function F(S) of basic structured tasks has natural differentiability. Its core goal is to minimize the error function E(S) (e.g., the number of constraint violations, distance to the target state), and the change in E(S) is continuous and smooth. For example, in Sudoku solving, each correct number filled in causes a deterministic decrease in the error E(S). In maze exploration, each step closer to the exit monotonically reduces the distance error. This smooth error reduction property ensures that the recursive function F(S) satisfies the conditions for applying Taylor's theorem: near the terminal state S_final, it can be expanded into a low-degree power series. (b) Parameter simplification logic of Taylor expansion. According to Taylor's theorem, the approximation formula for a differentiable function f(s) near s_final is: F(S) ≈ A₀ + A₁(S - S_final) + A₂(S - S_final)² + ... + A_K(S - S_final)^K. Here, A₀ = F(S_final) (self-mapping at terminal state, constant); A₁ = F'(S_final) (error reduction rate constant); A₂ = F''(S_final) (rate of change constant); K is the highest degree of the power series. The key point is that the constraint rules of structured tasks are hard logic; the error reduction pattern is extremely simple, requiring only the first 3–5 low-degree terms for high-precision approximation, with no need for high-degree terms. At this point, the model parameters are no longer the high-dimensional matrices of large models, but the one-dimensional coefficient vector A₀, A₁, A₂, …, A_K. The parameter scale drops from hundreds of billions to single or tens of digits. This is the core principle behind how TRM, with only 7M parameters, can defeat a hundred-billion-parameter LLM. 4. Engineering Advantages: Low-Degree Terms Satisfy Accuracy Requirements. From an engineering perspective, structured tasks have strong determinism in their patterns, requiring no high-degree power series to fit. For example, in Sudoku solving, only the first three terms A₀, A₁, A₂ can precisely describe the cycle of candidate number screening, digit filling, and error correction. In maze exploration, the first two terms A₀, A₁ can express the core logic of moving toward the exit while avoiding obstacles. This characteristic of low-degree approximation allows the model to have very few parameters and extremely fast inference speed, without the massive matrix operations of large models—only simple power calculations and coefficient weighting are needed, enabling deployment on edge devices. 5. Expansion Potential: From Task-Specific to General Structured Reasoning Models. Currently, small models like TRM are still limited to single tasks (e.g., Sudoku, mazes). However, based on the ideas in this article, a general structured reasoning small model can be further constructed. The core logic is that all structured tasks share the underlying framework of state machine + recursive function + differentiable error, requiring only a unified state representation and mathematical encoding of constraint rules to adapt a single Taylor expansion model to multiple tasks. For example: unified state representation: encode Sudoku grids, maze maps, and grammar symbol stacks all into vector-form states; constraint rule encoding: convert Sudoku non-repetition, maze no-wall-penetration, and grammar parenthesis matching into a unified error computation function; shared model parameters: the coefficient vector A₀, A₁, A₂ of the Taylor expansion can be trained on multiple tasks simultaneously (e.g., Sudoku, mazes, grammar parsing) to learn general patterns, eliminating the need to design a separate model for each task. Such a general small model can be widely used as a logic analyzer or efficient searcher in formal reasoning tasks (geometry proofs, logical deduction), structured data processing (table filling, rule validation), programming language tools (grammar parsing, code debugging), and game tasks (board games, path planning). Its efficiency advantage far exceeds that of large models: inference speed is increased by over a hundred times, deployment cost is reduced by ten thousand times, and accuracy is higher—no hallucination issues of large models, and results can be verified through constraint rules. Conclusion: Return to the Essence of Tasks, Reject Parameter Superstition. The parameter competition among large models is not the optimal solution for all tasks. For structured reasoning tasks, we should not pursue brute-force fitting with hundreds of billions of parameters, but instead return to the mathematical essence of the task: (1) identify the state and attributes of the task, clarifying the input state and constraints; (2) transform state transitions into differentiable recursive functions; (3) approximate the function with a low-degree Taylor expansion, replacing high-dimensional matrices with one-dimensional coefficient vectors. The small models under this approach are not only extremely parameter-efficient and highly efficient, but also possess generalization potential, providing a new optimization paradigm for the field of structured reasoning. As Einstein said, "Everything should be made as simple as possible, but not simpler." Abandoning the superstition of parameter scale and delving into the mathematical laws of tasks may be the future direction for AI to efficiently solve domain-specific problems.
back to top