Sutra: 以张量操作RNN作为向量符号架构的编译目标
Sutra: Tensor-Op RNNs as a Compilation Target for Vector Symbolic Architectures
AI总结:
Sutra是一种纯函数式编程语言,通过编译将整个程序降级为融合张量操作图,同时支持符号推理和神经网络训练,实现逻辑程序与可训练网络的统一。
摘要:
Sutra是一种带类型的纯函数式编程语言,其编译后的前向传播是一个PyTorch神经网络。编译器将整个程序——包括原语、控制流、字符串I/O——通过beta归约降级为一个在冻结嵌入基质上的融合张量操作图。旋转绑定、解绑、捆绑、多项式Kleene三值逻辑以及尾递归循环均被降级为张量操作;Kleene连接词是在{-1, 0, +1}真值网格上精确的拉格朗日插值多项式。验证通过两种方式测试同一事实。(1) 同一程序在跨越两种模态的四个冻结嵌入上运行——三种文本编码器(nomic-embed-text、all-minilm、mxbai-embed-large)和一种蛋白质语言模型(ESM-2)——并在每个基质上以宽度k=8实现100%的解码准确率,而教科书式的Hadamard乘积已经崩溃(mxbai-embed-large上2.5%,all-minilm上7.5%)。(2) PyTorch自动求导流经实际编译的图:一个用.su编写的模糊规则分类器从随机初始化(18.7±9.5%;随机概率=20%,五类)通过反向传播经过发射图(符号源未修改)训练到100.0±0.0%(三个种子)。一个加权变体额外训练一个标量余弦增益,并将其作为数值字面量写回.su源文件;重新编译重现训练后的行为,每个logit误差约2e-7,因此训练后的模型本身是可读、可重编译的代码。因此,同一工件既是一个逻辑程序,也是一个可训练的神经网络。
英文摘要:
Sutra is a typed, purely functional programming language whose compiled forward pass is a PyTorch neural network. The compiler beta-reduces the whole program -- primitives, control flow, string I/O -- to one fused tensor-op graph over a frozen embedding substrate. Rotation binding, unbind, bundle, polynomial Kleene three-valued logic, and tail-recursive loops all lower to tensor operations; the Kleene connectives are Lagrange-interpolated polynomials exact on the {-1, 0, +1} truth grid. Validation is one fact tested two ways. (1) The same program runs on four frozen embeddings spanning two modalities -- three text encoders (nomic-embed-text, all-minilm, mxbai-embed-large) and one protein language model (ESM-2) -- and decodes bundles at 100% accuracy through width k=8 on every substrate, where the textbook Hadamard product has already collapsed (2.5% on mxbai-embed-large, 7.5% on all-minilm). (2) PyTorch autograd flows through the actually compiled graph: a fuzzy-rule classifier written in .su trains from random init (18.7 +/- 9.5%; chance = 20%, five classes) to 100.0 +/- 0.0% (three seeds) by backpropagating through the emitted graph, the symbolic source unmodified. A weighted variant additionally trains a scalar cosine gain and writes it back into the .su source as a numeric literal; recompiling reproduces the trained behaviour to ~2e-7 per logit, so the trained model is itself legible, recompilable code. The same artifact is therefore both a logic program and a trainable neural network.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。