Tensor Logic“统一”AI范式 [Pedro Domingos]
Pedro Domingos认为,TensorLogic以张量方程这一单一构件统一符号规则与张量代数,并可覆盖深度网络、核机器和图模型。 核心观察是,“einsum和逻辑编程中的规则其实是一回事”,主要区别在于操作对象是实数还是布尔值。他将TensorLogic称为通用算法的脚手架,而非算法本身。
这一企业级命题是在有保证的演绎与带猜测性的类比之间提供一条可控光谱,或能解决幻觉这一限制AI落地的风险。 温度为0时,TensorLogic可以把结论限制在给定前提逻辑必然推出的范围内;提高温度后,则允许更宽松的类比推断,且理论上可逐条规则设定。关键限制是,在主持人追问下Domingos也承认:可靠的演绎无法挽救错误前提——“如果前提是幻觉,结论也会是幻觉”。
TensorLogic更具影响力的主张是,梯度下降不仅能学习手工设计网络中的权重,还能学习结构、谓词和表征。 Domingos将其与归纳逻辑编程中的低效搜索对比,并把“谓词发明”——从数据中发现原本不存在的关系——称为“圣杯”。Tucker式张量分解是这一更广义梯度下降框架下学习潜在因子的一条示例路径;但主持人仍追问,有用的架构搜索依然需要归纳偏置。
拟议中的开发模式,是用广义张量方程配合严格或软性的结构先验,降低对完全硬编码架构的依赖。 MLP和ConvNet都可以各自写成一个张量方程;研究者随后可以把信念作为方程加入,而不必完全固定拓扑结构。Domingos的实际推介是一种更迭代、也更可解释的工作流:“再写一个方程,或修改已有方程”,重新训练、检查结果,再继续调整。
Domingos认为,弱对称性相当于物理学的基础规律,但并不声称它们能消除不可约复杂性。 他预期大致是80/20的分工:紧凑规律和可约部分让系统走完大部分路程,而自发对称性破缺、新观测以及领域专用的工程修补负责剩余部分。操作层面的启示是以控制为导向的预测——像Kalman滤波或强化学习那样持续依据数据重新校准,而不是追逐Laplace妖。
长期目标是“通用归纳”:一种类似Turing通用机的学习机制,能从少量例子中推断可复用的程序,并在任意实际规模上应用。 主持人将孩子用很小的数字学会加法、再推广到任意长度,与上下文长度固定、问题规模变化后可能需要重新训练的transformer作对比。Domingos将此视为许多transformer的局限,也是TensorLogic要攻克的目标。真正重要的是这一能力问题,而不是形式上的无穷性或是否具备Turing完备性。
对投资者最重要的警告是,当前AI基础设施支出可能远远领先于能够高效利用这些基础设施的算法。 Domingos认为,暴力推理反映了计算机科学既有经验的遗忘,并预测“其中99.9%的算力”最终可能看起来都被浪费了,即便这些物理容量日后确实能找到用途。TensorLogic的商业化路径是渐进式的:先把方程编译成Python/PyTorch,在幻觉和黑箱不透明问题上赢得用户,再进入教育领域,最终甚至可能威胁“CUDA这条漂亮的护城河”。
1. AI要真正起飞,首先需要一种统一的工作语言
Domingos将TensorLogic视为自读博以来一直追求的目标:统一AI彼此竞争的范式。他的类比对象是物理学中的微积分,或电路设计中的布尔逻辑——一个领域一旦拥有能够捕捉基本操作的记法,进步速度就会加快。
早期符号语言提供了自动化、透明且可靠的推理,却缺少自动微分和GPU扩展能力。PyTorch和TensorFlow让学习与加速变得日常化,但推理仍处在它们之上的“各种补丁”层。TensorLogic希望把这3项能力放在一起。
他并未声称一种语言在所有任务上天然更优:计算机科学中“没有一种编程语言在所有事情上都更好”。但根据他目前的经验,TensorLogic对AI基本面的覆盖范围比预期更广——“不过,那是我的看法。我可能有点偏见。”
2. Einsum与逻辑规则本质上是同一种操作
张量代数可以归结为Einstein求和:矩阵乘法、张量积以及深度学习中的相关操作,都是einsum。Domingos所谓“令人目瞪口呆的观察”是:einsum和逻辑编程规则其实是一回事,只是实数算术与布尔算术构成了不同的原子数据类型。
他通过Datalog得到这一等价关系,因为Datalog的数据库规则可以归结为连接和投影。TensorLogic将两者推广为张量连接与张量投影:使用布尔张量时,它们还原符号数据库操作;使用数值张量时,则涵盖并扩展传统einsum。
点积就是乘积之和;换成布尔形式后,它变成合取的析取,也就是DNF。如果多个子句为真,阶跃函数会把超过1的值重新映射为1。多个具有相同头部的规则同样表达了隐含的逻辑“或”。
主持人提出NAND门挑战:具备通用性并不等于抽象层次足够好。Domingos对此表示认同。TensorLogic可以保留语法糖,但其原生层次远高于NAND:他说,一个transformer可以用大约十几个张量方程写出,而不必堆成“一大团代码”。
3. 更好的记法也可能释放更高效的执行
相比直接调用einsum API,第一个优势是记法。现有调用需要处理别扭的索引、箭头和参数;TensorLogic则让einsum读起来像一条规则:左边是输出张量,右边是连接后的表达式。“好的记法就是成功的一半。”
第二个优势是性能。Domingos认为,einsum的使用率低于其潜力,一部分原因是现有实现可能又慢又笨重;如果语言围绕一个原语组织起来,就可以直接优化张量方程,在CUDA中实现,让“Einstein终于发挥出全部潜力”。
但决定性差异在语义覆盖面。传统einsum只能执行张量代数;TensorLogic则让同一构件同时用于符号计算、数值计算、两者混合、推理,甚至学习符号部分。
4. TensorLogic为通用算法提供脚手架
《The Master Algorithm》曾将AI划分为符号学习、贝叶斯方法、核机器、图模型和神经网络等不同部落。如今,Domingos把TensorLogic称为表征层面的答案:“一种非常简单的语言,可以完成AI的整个谱系。”
图模型无需特殊机制就能纳入这一框架。其因子和条件分布都是张量,而边缘化与逐点乘法则变成张量投影与张量连接;核方法式计算也可以使用同一套代数词汇。
TensorLogic本身不是通用算法,因为语言不等于完整的学习流程。它是构建通用算法的脚手架,其底层已经具备推理和自动微分:由于只有一个构件,“TensorLogic程序的梯度仍然只是另一个TensorLogic程序”。
Domingos的目标不止于展示这套脚手架:“我打算很快把它做出来。”尚未补上的核心,是一个利用该语言发现模型、而不只是表达模型的通用归纳程序。
5. 梯度下降要学会发明结构与概念
主持人把核心问题说得很清楚:计算通用性只能说明某种表征能够表达一个解;AI还必须适应新颖事物,并构造正确的表征。Domingos的回答涉及归纳逻辑编程、张量分解和基于梯度的结构学习。
传统归纳逻辑编程通过贪心搜索或束搜索,在巨大的离散空间中发现规则,因此效率极低。Domingos认为,在TensorLogic中,“结构学习会从梯度下降中自然产生”——规则和关系可以在连续张量方程中变成可学习对象。
最强的主张是谓词发明:发现数据中没有明确出现、但能更紧凑地解释数据的关系。对象本身就是被发明出来的谓词,而不是视网膜像素;力、能量和熵等科学概念也体现了同样的表征跃迁。Domingos称这是“AI的关键问题”,也是“圣杯”。
Tucker分解是这一思路中的一个示例机制。正如矩阵可以分解成2个潜在矩阵、以紧凑方式复原其内容,数据张量也可以通过新学习的张量来表达;这些因子可以继续保持数值形式,也可以经过阈值化变成布尔概念,供人检查。
6. 广义方程仍然需要强归纳偏置
主持人的质疑值得保留:一个拥有过多自由度的全连接网络,不会因为表征更整洁,就自动变得实用。今天这些“神谕般的咒语结构”之所以存在,是因为不受约束的SGD通常无法自行发现有用的拓扑。
Domingos区分了紧凑表达与无约束学习:一个使用单一非线性的完整MLP可以塞进一个张量方程,带有局部性偏置的完整ConvNet也一样。一个通用方程定义的是一族架构;学习得到的张量值,则可以在这族架构中具体化出某个网络结构。
他承认没有免费午餐,也不建议尽管算力充足就盲目暴力搜索最大的架构族。相反,研究者可以加入表达部分结构信念的方程:有些是硬约束,有些是软约束,让梯度下降从带有结构知识的起点开始,而不是从白纸开始。
开发循环仍然是经验性的:先指定广义结构,训练,检查结果,再增加或修改方程。Domingos认为,这能同时提高程序的效率和透明度;经过适当离散化后,学习得到的规则也可以被看见,而这是transformer“根本不可能指望”做到的。
7. 对称性或许能解释80%,但解释不了整个世界
Domingos认同几何深度学习,并称最强的弱偏置是对称性。物理学标准模型很大程度上就是一组对称性,说明简单规律如何约束巨大的复杂性;而张量记法本来就是物理学表达这类结构的自然语言。
主持人援引David Krakauer的划分:一边是封闭、可逆、由对称性主导的经典系统,另一边是开放、自组织、耗散、不确定且自适应的系统——生命和智能属于后者。现实或许过于建构性、过于“棘手”,无法通过干净的因子分解恢复有意义的概念。
Domingos的综合答案是“对称性与自发对称性破缺”。物理定律仍然适用,但不断累积的破缺催生出生物、心理和社会层面,在这些层面上,底层物理定律已经失去实际解释力;进化和大脑放大了一些偶然性,另一些则被淘汰。
他的预测是80/20:紧凑规律或许贡献80%的能力,剩余20%则需要累积的例外和工程补丁。TensorLogic既要处理干净的方程,也要处理那些笨拙的残余工程。
8. 不可约性会把预测变成持续控制
Domingos接受混沌、计算不可约性以及“更多就是不同”这些观点。他与更强不可约性主张的分歧在于量级:整个宇宙或许不可约,但其中存在大量可约部分,而进化和大脑会积累并利用这些部分。
正确回应不是要求根据初始条件做出完美预测。系统应先尽可能化约,再持续纳入新的观测:航空航天工程师使用的Kalman滤波,以及强化学习,都会在每一步更新预测,而不是相信一条一次性确定的轨迹。
这会把预测转化为干预。“你实际上只需要把事情预测到足以控制它们、让它们变得可预测的程度”;人类会不断重塑环境以使其稳定,Domingos认为机器人也需要采取同样的闭环策略。
9. TensorLogic被定位为跨层级的元语言
另一位主持人援引Hofstadter:智能会在多个描述层级之间移动,且往往保留多个有用理论。尽管广义相对论和量子力学描述的是不同区间,牛顿力学在人的尺度上仍然有价值;为什么要期待一种AI语言取代所有层级?
Domingos的回答比主持人预期的更强:“我绝对是在主张,TensorLogic就是所有这些层级都应使用的语言。”相对论和量子力学已经在使用张量,而TensorLogic进一步提供了构造新表征、并在不同表征之间切换的方法。
关键区别在于单一表征与元表征。智能可能需要多个处于相同或不同层级的表征,但张量方程可以描述这些表征如何组合、学习和切换;真正的错误,是把自己锁定在一种固定表征中。
他把这一主张延伸到了科学。一个TensorLogic程序可以几乎照搬纸面上的方程,把数值计算与周围的逻辑结合起来;更重要的是,它能让这些逻辑变得可学习,而不是永久手写。
10. 星号索引暴露了有意设计的泄漏抽象
主持人质疑RNN示例中的星号时间索引是偷偷塞进语言的额外构件。Domingos区分了必要语义和实现提示:像T+1这样的普通表达式可以视为语法糖,而星号只是节省内存的提示,并没有增加计算能力。
在一个索引上写星号,意味着执行时复用存储空间,而不是保留每一个状态。在RNN中,新状态会覆盖旧向量,就像状态转移系统一样;如果需要历史记录,就不要加星号。“所有抽象都会泄漏”,而TensorLogic允许程序员在效率重要时显式暴露这一细节。
对于π的小数位这类无界序列,前向链接会填充向量中的连续位置。理想的无限向量会一直延伸;现实中的有限向量则会在内存耗尽时停止,正如任何实体计算机一样。
TensorLogic同时具备声明式和过程式语义。一个方程可以被理解为关于世界的陈述,也可以被理解为函数调用:左侧是调用,右侧提供函数体。Domingos说,他经常以过程式方式使用这门语言。
11. Turing完备性主张经受了尖锐的技术争论
主持人指出,引用的1995年Siegelmann构造依赖无限精度的有理数寄存器和一种特殊结构的RNN,因此更像玩具,而不是实用、通用TensorLogic的证据。这一质疑同时针对证明所依赖的数值域和固定架构。
Domingos同意这一构造“没有任何实际意义”,并表示引用它只是因为它能用一段话证明形式结果。他称还有其他证明,更根本地说,在有限的物理世界里,Turing完备性“完全、彻底地不重要”。
真正重要的是计算通用性:能够表达任何实际需要的计算。Domingos认为,TensorLogic可以实现有限控制;配合外部读写内存操作,还可以把内存表示成按地址索引的向量,并表达读、写以及通过更新索引进行移动。
主持人仍然谨慎,认为外部读写操作看起来像是对普通张量数学的扩展。Domingos把它们放在逻辑编程一侧,称实现几乎微不足道;但讨论最后,主持人仍希望看到具体的完整示例,而不是把问题视为已经彻底解决。
12. 实用通用性意味着超越训练规模进行泛化
主持人对transformer提出了更尖锐的主张:问题不是形而上的无穷,而是复用。一台Turing机可以耗尽内存,接入更多内存后继续运行,无需重新编程;相比之下,主持人认为,传统transformer扩大上下文长度后需要重新训练,而不是简单恢复同一套已学程序。Domingos则强调,TensorLogic要解决的是更广义的transformer规模化局限。
Domingos希望系统能够从小规模案例学习,并迁移到任意实际规模:孩子用短数字学习加法,却可以把这套程序应用到更长数字上。图、知识库和推理问题也应该如此——“从非常小的规模推广到任何规模”。
按他的说法,Turing的成就是那台反直觉的通用机——一台实际上可以“一只手打字、另一只手缝纫”的设备。后来的等价计算形式进一步表明,相比通用性,表面上的机器结构并没有那么重要。
他的研究问题是用学习取代演绎:“Turing机是演绎的模型,是通用演绎。我们缺少的……是通用归纳。”他预计会出现许多等价的通用算法,就像存在许多等价的通用计算模型一样。
13. 温度把精确演绎与结构类比连接起来
在嵌入空间中,单位向量与自身的点积为1,而随机高维向量之间的点积接近0。因此,它们的Gram矩阵近似单位矩阵;足够陡峭的sigmoid会清除残余噪声,把结果变成布尔形式的恒等关系,让逻辑规则能够执行演绎。
支持相似推理的对象,其嵌入会在学习过程中彼此靠近。温度为0时,阶跃函数会把相似度离散回0或1,实现纯演绎;提高温度后,则允许相似对象之间进行越来越宽松的类比迁移。
Domingos把证明搜索描述为模拟退火:先在高温下探索类比,再逐渐降温,直到结果变成演绎证明。他说,数学家“会注意到事物之间的相似性”,但“归根结底,你需要的是证明”。
主持人的沙堡质疑仍然关键:形式上有效的推理,仍可能建立在一个没有正确捕捉现实的表征之上。Domingos区分了这一提议与单纯重写MLP或transformer的做法,但也同意,TensorLogic不会神奇地证明一个学习到的世界模型为真。
14. 结构映射比统计相似性更丰富
Domingos明确拒绝把相似性等同于完整类比。最近邻和核方法只提供最弱形式的相似关系;强大的类比需要结构映射,即把一个问题中的关系和组合方式映射到另一个问题上。
Dedre Gentner的经典例子是Bohr对原子与太阳系的映射:原子核对应太阳,电子对应行星。Domingos指出,“结果证明这是一个糟糕的类比”,但它对物理学极具启发——这提醒人们,生成性类比与最终正确性属于不同阶段。
基于案例的推理在实践中使用同一机制:帮助台检索结构相似的问题,并调整其解决方案,而不是从头开始求解。TensorLogic声称的优势,是把核方法式相似性与符号组合性结合起来,从而支持嵌套映射或多个案例的组合。
15. 企业需要的是可靠性,而不是全知全能
主持人指出,GPT即便在温度为0时也会产生幻觉,糟糕的演绎系统同样会输出胡话;确定性与真理是两回事。Domingos同意这一点,但认为GPT在温度为0时仍然失败,正是企业需要另一种模式的原因。
《财富》500强企业的要求是操作性的:必须遵守业务规则、维护安全约束,不能欺骗客户。TensorLogic可以为不同规则分配不同的推理温度:数学或政策约束保持硬约束,其他地方则允许更柔性的证据累积。
相比RAG,拟议系统不只是检索事实,还会计算这些事实的演绎闭包。Domingos称这“强大了指数级”,同时仍把结果限制在前提许可推出的结论之内。
他提供的是技术可靠性,而不是事实全知。TensorLogic可以确保结论在逻辑上由前提推出,却无法确保前提对应现实。“如果前提是幻觉,结论也会是幻觉”——模型获取与模型验证仍是两类不同问题。
16. 落地将依靠痛点、互操作性和算力经济学
Domingos承认,单靠技术优雅无法击败既有生态:“你杀不死COBOL。”Lisp和Prolog尽管在AI方面具备优势,仍因通用生态的网络效应更强而失势;Java则从互联网时代的工作负载中找到突破口,因为旧语言处理这类任务并不理想。
TensorLogic的切入口将是强烈痛点——幻觉、黑箱不透明,以及高管无法信任黑箱系统。迁移可以从预处理器开始,将张量方程逐一转换成NumPy、Python或PyTorch,在保留现有代码的同时增加更容易的推理能力。
教育也是一个切口。一种语言可以教授AI的整个谱系,让学生不必把时间耗在偶然性的语法上;由于张量方程也能近似映射到底层GPU工作,专家仍然可以继续深入优化。Domingos开玩笑说:“CUDA是一条漂亮的护城河,但TensorLogic可能会让这条护城河走到尽头。”
他最后提出了更尖锐的资本配置批评:transformer确实是一次真正的跃迁,但对既有推理方法的无知推动了暴力式投入。他预测,人们最终可能会得出结论:“其中99.9%的算力完全被浪费了”——这是一次价值万亿美元的教育;借用《心灵捕手》的说法,学费最终只相当于“图书馆逾期费1.5美元”。
TensorLogic unifies not just symbolic AI and deep learning; it also unifies things like kernel machines and graphical models. I'm Pedro Domingos. I'm a professor of computer science at the University of Washington in Seattle and a longtime machine learning researcher. My dream from my PhD onward has always been to unify all the different paradigms of AI into a single one.
My PhD unified 2 of them. My best-known research unifies a couple of others. I wrote this book that turned into a big bestseller, surprisingly, called The Master Algorithm, which is precisely about this goal and where we are toward that goal. My latest work, which this podcast will talk about, is a new language called TensorLogic that, I would say, for the first time brings this dream of a unified representation, a unified solution to AI within reach.
Tim Scarfe
I can set the temperature of GPT to 0, and it still hallucinates. And I can have a poor deductive system that hallucinates all kinds of things. So, to me, those are separate problems.
No, very good. Precisely, the problem, or one of the problems, with GPT is that it hallucinates even when you set the temperature to 0. What the hell, right? I want to have a mode—
Tim Scarfe
Yeah, yeah, yeah.
Right? Not I, but every Fortune 500 company, if it's going to use AI, needs to have a mode where the logic of the business is simply obeyed, the security isn't violated, the customer doesn't get lied to, et cetera. We've got to have that, or they will not take off, right? Transformers can do that. TensorLogic can do that precisely because, in the reasoning mode that I just described, if you set the temperature to 0, it does purely deductive reasoning. By the way, the temperature can be different for each rule.
There is this thing called predicate invention, which is discovering new predicates, discovering new relations that are not in the data but explain it better. I would say that, in some sense, discovering representations like that is the key problem in AI; it is the holy grail.
What was Turing's achievement that we now take for granted? Turing's achievement, for which he is deservedly famous, was to postulate this notion of a universal machine. The amazing thing about computers is that they're universal machines, which in his time was a completely counterintuitive notion. What do you mean, a machine that can do everything?
The typewriter can type; the sewing machine can sew. You're telling me there's a machine that can type with one hand and sew with the other? What are you talking about? That's the genius, right? So, the first step is to have this property of having a machine that can do anything. What we're missing to be able to do what the universe and evolution do is universal induction. What is the Turing machine equivalent for induction, for learning? That's what I'm after.
Tim Scarfe
Professor Pedro Domingos, it's amazing to have you back on MLST. I've lost count of how many times we've had you on the show now, so it's amazing to have you back. The main reason that we've invited you today is that you've just released a brand-new paper called TensorLogic: The Language of AI. You said fields take off when they find their language. You gave the example of calculus in physics and Boolean logic when designing circuits. What's the idea behind this paper?
TensorLogic, in many ways, is the goal that I've been working toward my entire professional life because I really do strongly believe that a field cannot take off until it has really found its language. TensorLogic, I believe, is the first language that really has all the key properties that you need in the language of AI.
For example, it has automated reasoning right out of the box, like Prolog has. The classical languages had a number of things that we just took for granted. Transparent and reliable reasoning—you didn't even have to worry about it; it was just already available. At the same time, you don't have that in PyTorch at all. You have all these hacks to try to do reasoning on top of it.
At the same time, Lisps and Prologs never had automatic differentiation—the ability to learn. One of the beauties of the current moment, in many ways, is that you barely have to look at most papers; people barely talk about the learning because it's already implemented under the hood. So, you want that as well, right?
You want scalability on GPUs; that's the other thing that things like PyTorch, TensorFlow, and whatnot give you. There was no language before that had all of these, and there are a number of others, but these may be some of the key ones. TensorLogic is basically a language which, as the name implies, is a marriage—a very deep unification—not just some superficial combination of the tensor algebra that deep networks are all built out of and the logic programming that symbolic AI is built out of.
There's only 1 construct in TensorLogic, and it's the tensor equation. You can do everything with tensor equations.
Tim Scarfe
Are you saying that there's only 1 language of AI? Certainly, in some fields, like physics—you gave the example of calculus—almost all of physics involves quite a bit of calculus. There are other fields where, actually, there are multiple languages that play almost equal roles. So, I'm wondering: do you think TensorLogic is going to be 85 or 90-plus percent of the way that we should be talking about and thinking about AI, or will it be a mixture of different languages?
That is a very good question. In fact, we know very well in computer science that there's no one programming language that's better for everything. There's just people who think it is. Everybody has their favorite language that they believe is the universal solvent, but it never really is. We know also, for fundamental reasons—going back to Shannon and whatnot—that there is no language that is the most pithy for anything you might want to say.
Having said that, physics is a good example because calculus is so fundamental. Feynman famously said that he thought in calculus. The thing that I found with TensorLogic is that I don't know how much of AI it's going to be or how much it should be, but what I have found, in many ways to my surprise, is that TensorLogic is more than just a programming language. It really, I think, captures the fundamentals of what you need in AI in a way that, going in, I didn't even think was possible.
All of tensor algebra can be reduced to this operation which, going back to physics, is called the Einstein summation. Einstein summation was something that was introduced by Einstein when he was working on relativity and got tired of writing summation signs. It was all about tensors. General relativity is all about tensors. He jokingly called it his great contribution to mathematics.
But the bottom line—and there's this great paper, or blog post, by Tim Rocktäschel saying, “Einstein Is All You Need”—is that you can do all of deep learning with just einsum. All of the matrix multiplications and tensor products, all of that, are instances of einsum.
On the one hand, in symbolic AI, it's all about rules. TensorLogic is based on this, to me, gobsmacking observation that an einsum and a rule in logic programming are the same thing. They are actually the same thing. The only difference is that one is operating on real numbers and the other one is operating on Booleans, but that's just a different atomic data type.
To summarize, at this point I think that it would be crazy not to do these things with TensorLogic.
There may be other, better things coming later, but at this point I would say TensorLogic is probably better for what people are doing across the board. But hey, that’s me. I may be a little biased.
Tim Scarfe
First of all, shout-out to Tim Rocktäschel. I read that blog post from 2018 earlier, the one you were referring to. But I suppose the thought occurs that, if it is mostly about einsum, you might make the argument: Why do we need an abstraction when we already have a great abstraction in einsum? Folks can now use PyTorch and JAX. What exactly does your abstraction allow them to do that they can’t do with PyTorch?
No, very good. It does several things. First of all—and this is going to be in increasing order of importance—the syntax of einsum in these languages—there’s also this package called einops—is incredibly clunky. So, at a very basic level, TensorLogic is just a much pithier, more compact, easier-to-write-and-understand way to write einsum expressions.
Physicists and mathematicians are famous for liking to say that a good notation is half the battle. This might not seem like a big deal, but my experience is that you can just think better and faster once you have this notation rather than this funky procedure call with these indices, these arrows, and these arguments. It’s a nightmare. The syntax of TensorLogic is especially natural: You write an einsum the way you would write a rule. There’s a tensor equation with a tensor on the left-hand side and a join of tensors on the right-hand side.
Another very important aspect—and one that I think could prove decisive—is that people don’t use einsum much because it’s not very efficient. Under the hood, it’s not as efficient as it could be. Sometimes I think, “This could be done so much better,” right? But I’ve done some programming of this, and I wound up not using einsum because it’s so slow and clunky. All of that can be fixed once you have this one abstraction of the tensor equation and you implement it on CUDA, for example. You can optimize the heck out of it, and einsum will finally be able to reach its potential, right?
Actually, none of these things should be the most important part. The most important part is that einsum, as we know it, is only good for tensor algebra. TensorLogic is a language where the same construct does all the symbolic and all the numeric parts, and any mix and variation between them, including learning the symbolic part and whatnot. These are all things that in the einsum world just didn’t exist, right?
You talk about the people who knew einsum, whether in AI or mathematics or physics, and they just had no idea that any of this had anything to do with reasoning. You look at all the ways that people are trying to do reasoning today and just want to pull out your hair.
Tim Scarfe
Let me ask a very concrete question. In some sense, I’m a simple man. I need a very concrete example, because I completely agree with you: The symbols we use, the language we use—simplicity is so fundamental to our ability to reason at higher and higher levels.
So let’s take one example from your paper, which is that a logical OR of a bunch of values is equivalent to an einsum with a Heaviside function applied to it. You give this example, right?
To be precise, what I did in the paper—maybe this is an important piece of context—if you look at the simplest form of logic programming, it’s Datalog, right? That’s the foundation of databases. Most SQL queries are variations on Datalog rules, and Datalog rules are composed of 2 things: joins and projections. This is databases 101.
What I have done is generalized join and projection to numeric values. There’s this thing that I define called the tensor join and the tensor projection, which, when the tensors are Boolean, becomes the regular symbolic database version, but now the numeric version has all these things as special cases. And, by the way, it’s also more general than einsum, right? So another benefit of this is that it actually goes beyond einsum.
Now, an OR—the way you get an OR is just as in Prolog or Datalog. How do you get an OR in Prolog or Datalog? By having multiple rules with the same head. Those rules are then implicitly disjoined. If I have “A if B and C” and “A if D and E,” then that means “A if B and C or D and E.” The same thing happens here.
You could also, of course, just put them all in the same equation, because it might be more convenient just to say, “AB + CD,” right? So doing an OR is a completely straightforward thing, but it’s really not where the main action is. It’s in the tensor joins and tensor projections.
Tim Scarfe
Thank you for laying all that out. Completely agreed; it makes sense. I just wanted to clarify the very example I was giving: An einsum over a particular index of Boolean values, followed by a Heaviside function applied to that element—which is just 0 if it’s less than 0 or 1 if it’s greater than 0—is equivalent to a logical OR over all the same Boolean values of that index.
Yeah, sorry. I see—I understand your question. So, again, it’s more than that. It’s a DNF, right?
Tim Scarfe
A DNF is a disjunction of conjunctions.
Yeah, exactly. And so what happens is that the einsum is—in numeric land, think of a dot product. The dot product is just the sum of products, which in Boolean land will be a disjunction of conjunctions. If more than 1 is true, you get a number that’s greater than 1, which you need to pass through a step function to reduce all the values greater than 1 back to 1.
Tim Scarfe
Yes, but my question was more like, okay, I have these 2 different representations of the same operation, at least at the element level. An einsum over an index followed by a Heaviside on that element is equivalent to an OR over all the same Boolean values of that index.
My question is per element. So my question to you is: I give up 1 thing, which is that instead of having a single symbol that’s kind of like an OR, I’ve now got 2 operations, einsum and Heaviside. And there are many examples of that, right? I can build every single circuit out of NAND gates. I think we discussed this once, actually. Or I can have other kinds of gates, and it’s useful to have other kinds of gates.
So, in your language, do you foresee people not having syntactic sugar like an OR operator, which under the hood is einsum plus Heaviside, or would they still retain those? It’s just that the fundamental, most basic constructs of the language are Tensor Logic.
We can do everything with NANDs, so why do we need high-level programming languages at all, right? The point is that there are 2 things that you want the language to be. First of all, you want it to be universal, so you can—For some things you don’t, but in general, for AI, surely you want a universal language. You want something Turing-complete and Turing-large, and Tensor Logic is that.
But this is actually the most important and most difficult part: You want something that’s at the right level of abstraction for the things that you want to do. And NAND definitely is not. I can show with a lot of examples that I have in the paper, for example, that you can code a transformer in a dozen tensor equations as opposed to a vast mass of code, right?
And then what happens when people have a language that suits their needs is that they just get used to it. They often wind up using it even for things that it wasn’t the perfect thing for, but at that point it’s what they’re comfortable with. So my guess is that at the end of the day people are just going to do everything in Tensor Logic, and they know, in the back of their heads, that, yes, there are ORs going on here, and you can think of them as ORs, but they just think of them as joins and projections and tensor equations.
Tim Scarfe
Very good. And by the way, you can implement transformers and anything else in Tensor Logic. It’s so easy, in fact, that I fed your paper into Claude Code, and I got it to implement the whole lot this afternoon. Maybe I’ll publish that on GitHub if folks want to have a look, but it’s quite straightforward.
Just to get the trajectory a little bit here, Pedro, you’re famous for writing The Master Algorithm. In that book, you spoke about all of these different tribes of machine learning, like Bayesian folks, logic folks, kernel methods, neural networks, and all of this. Do you see this as a step toward unifying these things together? Because now in Tensor Logic, you can actually create a composition of different modalities of AI, and it just works, but this might seem a bit weird to people. Can you explain what that might actually look like?
Absolutely. So, in a way, The Master Algorithm was laying out my agenda, right? It was asking the question, “What is the master algorithm?” I did say at the outset, “I’m not going to give you the master algorithm in this book. I’m just going to tell you where we are and why I think this is the central goal of AI.”
I would say that Tensor Logic is that answer. We haven’t talked about that yet, but Tensor Logic unifies not just symbolic AI and deep learning; it also unifies things like kernel machines and graphical models. The things that graphical models, for example, are built out of, and that you can compute probabilities with, are a direct— I didn’t do this on purpose, but it just fell out.
The fact that the factors that graphical models are made of are just tensors. The marginalization and pointwise products that probabilistic inference is made of are just tensor joins and projections on those tensors that represent potentials and, in the case of Bayesian networks, conditional distributions.
At this point, we do have this very simple language where you can do the entire gamut of AI, which, honestly, I didn't think was going to be possible going in. I thought the answer would be much more complicated. Now, is this the master algorithm? Tensor Logic per se is not the master algorithm because it's just a language. I would say that it's the scaffolding on top of which you can build a master algorithm.
Tensor Logic is not just a language; it's also the learning and reasoning facilities under the hood. For example, one of the best things about Tensor Logic is that the autograd graph is incredibly simple, because there's just one construct: the tensor equation. The gradient of a Tensor Logic program is just another Tensor Logic program. So this is all there. The learning and the reasoning are all there.
However, what I would say is that this is not the master algorithm per se, but it's what we need to produce one, and I intend to produce it on short order.
Tim Scarfe
You've described a language, and certainly, if components of that language are Turing-complete, that's a big, vexed issue. We'll come back to that a little bit later. But because of computational equivalence, from an expressibility point of view, we can describe anything in the universe.
So we've got this framework, but to me, the challenge in AI is structure learning. As well as being able to express stuff, it's being able to adapt to novelty and create, perhaps from building blocks that we already have, a new structure to allow us to do something useful in that domain. I can't quite make that leap with your technology yet. So how do we do the meta thing where we actually build the Tensor Logic constructions to represent the kind of world that we're seeing?
Oh, very good. I actually go into that in the paper, but briefly. The paper is just an informal introduction to these ideas. Inductive Logic Programming is the field that deals with discovering rules from data. But it does this by things like greedy search or beam search, and it's a very large search space and extremely inefficient, right? Which is actually one of the things that killed it, even though it could do all these things that people in deep learning are just painfully rediscovering.
In Tensor Logic, this is one of the best parts of it: structure learning falls out of gradient descent. Gradient descent actually does structure learning. And on top of that, this is actually the best part as far as the learning is concerned: there is this thing called predicate invention, which is discovering new predicates, discovering new relations that are not in the data but that explain it better.
I would say that, in some sense, discovering representations like that is the key problem in AI; it's the Holy Grail. Everything that we know—when you look at the world, you don't see pixels. You don't see photons hitting your retina; you see objects. The objects are invented predicates. All the way up to science, Newton's genius was to introduce a new quantity, which is force, and energy and entropy, and all these, et cetera, right?
In Tensor Logic, that also just happens by gradient descent. It's hard to believe, but let me just give you a hint as to why this is the case. There's this other thing that's folded into Tensor Logic, which is tensor decompositions. Tensor decompositions are a generalization of matrix decompositions.
If you think about matrix decompositions, to take that simple case, what a matrix decomposition does is take a matrix and decompose it into 2 new matrices that together are more compact but essentially reproduce the same data. There's a generalization of that to tensors called the Tucker decomposition. There are others, but the Tucker one is the most relevant one here.
So, to answer your questions very directly, if you write in Tensor Logic a rule schema, including a data tensor on the left-hand side—and by the way, your entire data can just be reduced to a single tensor, represented as a single tensor; we can touch on that later—you write a rule expressing that as a function of a few other tensors, and gradient descent, just as in matrix factorization, will discover the best values for those.
Then, if you want to, for example, discretize it, say, “I'm going to threshold this and make it Boolean again,” you will see what concept it learned, or you can leave it in numeric form. So the learning is actually extraordinarily powerful.
I've always thought—and I think a lot of people in deep learning really believe this—that gradient descent can do amazing things, provided you give it the right architecture to operate on. In a way, what all these million papers are about is finding the right architecture for gradient descent to operate on. And of course, transformers are a great leap forward, but I think Tensor Logic is an even greater leap forward.
Tim Scarfe
How so? Because, for example, I can picture—suppose we want to get rid of Python. So I'm over here in PyTorch, and I've described all my layers in the clunky syntax and said, “No, now I have the Tensor Logic programming language on GitHub. Let me go do it there.” I'm still going to construct my layers, right?
Because, for example, you do, of course, allow for the nonlinearities, right? So after every einsum, I can apply whatever kind of nonlinear function I want—a ReLU or sigmoid or whatever else, right? That's still going to be described in my program. I'm still going to have to do that kind of structuring of the network, if you will, except now in Tensor Logic.
In my opinion, that's one of the biggest limitations right now. These are all just divine-incantation structures that people have come up with: let's put in a dropout layer here and this kind of layer there. We don't actually allow the machines to learn the overall topological structure. We only allow them to find weights within that structure.
No, but I understand your question. Tensor Logic does allow that. Step 1: you can encode a multilayer perceptron—the entire multilayer perceptron—and I do that in the paper with a single tensor equation. All the layers, provided that they all use the same nonlinearity, can be encoded in 1 equation.
You can also have different equations for different layers, or typically sets of layers, however you please. But from the point of view of structure discovery, the thing to realize is that if you set up one of these very general equations that you can create in Tensor Logic, which, in some sense, can represent a very broad class of architectures, then what the learning does is discover the architecture within that space.
If you think about it, at some level, when you compare an ordinary multilayer perceptron with a set of rules, you can see the connection. In fact, there was a system called KBANN in the early days that did this very cleverly. It initialized a multilayer perceptron with a set of rules because each neuron is a rule, right? But it's also more flexible because now you can have weights, right? A single neuron can represent a conjunction, and therefore a layer can represent a disjunction, and so forth.
When you're learning weights in an ordinary neural network, you can actually see it as learning the structure of a set of rules. What Tensor Logic is doing is this at a more powerful level. That was just propositional, and now this is at the full level of generality of first-order logic.
But you can learn the structure, and then, of course, there's more than 1 way to do that. You can also decide how black-and-white you want the structure to be, what you want to leave as weights, and what you want to discretize. But the structure itself can be learned by taking a tensor equation. A tensor equation is a very general thing, right? When you learn the weights of those tensors, that materializes into a specific network structure.
Tim Scarfe
Yeah, so I understand that. Let me bring this back to the folks who are familiar with PyTorch or traditional techniques. What you described is, yeah, I can just create a fully connected network with however many layers I want and let SGD find all the weights. That doesn't work. It doesn't work in practice, and it's not going to work with Tensor Logic. It's just a different representation of the same fundamental problem, which is that there are too many degrees of freedom. It's not going to learn anything useful.
This is why so much alchemy goes into structuring constrained networks to have certain built-in inductive biases, right?
No, absolutely. To take another example, you can also do an entire ConvNet in just 1 tensor equation.
The quintessential example of fully connected layers not working is a multilayer perceptron for vision, which you replace with a ConvNet that actually has the local structure. That is also a Tensor Logic equation. Now, you're saying, “Well, how do you choose between the ConvNet and an MLP?” Very good question.
These days, you can start out with a very general structure because GPUs and large server farms give you an amazing amount of power for something like this. You can almost, I would say, brute-force that search, provided you have the data. I'm not actually recommending that you do it.
You can also, however, and more interestingly, write down what you believe are properties of the structure. When you program a network in Python, you have to commit. You say, “Here's the structure,” and the only thing that happens is the learning of the weights.
In Tensor Logic, you don't have to do that. You can set up one of these very general structures and then say, “Let me give you a bunch of equations that are things I believe to be true about the structure but do not completely determine it.” Those work like priors and, indeed, like soft priors. You can turn the temperature up or down and say, “You've got to obey this equation and that one.” Sure, you can override them.
In my experience, this is actually what is important: that gradient descent, instead of starting from a tabula rasa, has this kind of soft knowledge. Most importantly, you—the developer, the AI researcher—get to do this. This is really the essence: every deep-learning researcher or data scientist knows that you don't set everything up a priori and then push the button and hope for the best. There's an iterative loop where you set up the structure, learn, get the results, and then refine the structure.
What this does is make that process much more efficient because, in your interpreter, you just have to write one more equation or modify an existing equation. Also, the entire stack of what you learn is much more interpretable than it was before. That's actually, in some ways, one of the most important properties of Tensor Logic: you can understand what's going on much better than you could before.
There are 2 ways. One is that the code is much more transparent than the whole pile of things sitting under a bunch of PyTorch procedure calls. The other is that the result of learning—at least if you do it in certain ways that I discuss in the paper—is transparent in a way that a transformer simply can't hope to be.
Tim Scarfe
We've covered some interesting topics on MLST before. Of course, there's geometric deep learning, which is this idea that symmetries are fundamental. We've spoken with Andrew Wilson from NYU recently about soft inductive priors, and I've just spoken with Yi Ma about his CRATE series of architectures.
I guess the prevalent idea here is almost Platonistic: there are real, natural patterns, and if we bias the model, as you're alluding to, it will converge on really good representations that describe reality. The alternative view is that reality is constructive and gnarly, and that won't work.
You were talking about your Tucker decomposition earlier. That's the idea that we might have a large, sparse matrix, we might want to densify it, and we might want to factorize it. The factorization will pull out some of these natural orderings of the universe, perhaps. I was thinking, isn't it a bit like a gzip algorithm? What if these factorizations are just semantically meaningless? How do you know that you've got a good one?
Great question, and you've touched on several things there. Let me start with geometric deep learning. I'm a big fan of this. In fact, I gave a keynote at the 2nd ICLR on something that I called symmetry-based learning, which is in some ways an ancestor of geometric deep learning.
I really do think that the universe possesses these fundamental symmetries. Actually, I don't think that—that is known, right? In physics, the Standard Model is basically a bunch of symmetries. It's extraordinarily powerful that such simple things could be such universal regularities, so that you can basically build everything else out of them.
If you think about it in machine learning, the problem is: what is the learning bias that you should start from? Should you pull in a lot of knowledge? Should you have a very vague architecture? There's the no-free-lunch theorem, which says that if you don't assume anything, you can't ever learn anything.
What's amazing about machine learning is that, with very weak biases, you can get very far. I would submit that those weak biases—fundamentally, at the end of the day, the most important ones—are these symmetries. Tensor Logic is precisely the perfect language for expressing those symmetries, as physicists will tell you. It's what they use—not the logical version, but the numeric version.
I think we can discover those regularities. I have some suspicions as to what they might be, but we're not quite there yet. Once we have those regularities, in some sense, they will play in AI the role that the Standard Model plays in physics.
Now, of course, there are people who say, “Oh, forget that. Going back to Marvin Minsky, there is no small set of AI laws or anything. It's just one damn thing after another. You're dreaming.” I respect that point of view, and we will find out empirically. But if I had to guess how this is going to play out, at the end of the day, it's going to be like this: this stuff gives you the 80/20. It gets you 80% of the way, and then for the other 20%, you have to do a lot of these things and a lot of hacks.
Since Tensor Logic still makes it much easier and faster to do those hacks than if you didn't have it, it actually gives you a benefit both in the 80% part and in the 20% part.
Tim Scarfe
There are folks in complexity science. There's this guy called David Krakauer, and in his book, on the first page—actually, in the very first sentence—he discusses the scientific and social implications of differences between:
A, closed, reversible, symmetry-dominated, and predictable classical domains; and B, open, self-organizing, dissipative, uncertain, and adaptive domains.
I think that's what you're talking about—the kind of Roger Penrose-type world. Now, I think the latter is where all the interesting stuff in the universe is. It's where life and intelligence and all the other things we want to model are. Could it be the case that those things are not reducible in the way that you're arguing they are?
I'm glad you asked that question, because this really is the crux of the matter. Also, you're probably familiar—I know you're familiar because we've talked about it before—with Steve Wolfram's notion of computational irreducibility, right?
Tim Scarfe
Yes.
And, of course, we now understand very well that many systems are chaotic and therefore inherently unpredictable. There's complex systems and all of that.
Tim Scarfe
Exactly. The whole notion that “more is different” is a very famous notion in condensed-matter physics, and I'm a very strong believer in it. So doesn't that contradict what I just said?
Actually, no. I would say the following: from physics all the way to AI, with biology in the middle, the universe is basically composed of 2 things: symmetries and spontaneous symmetry breakings.
God made the symmetries. The symmetries are the laws. As far as we can tell, none of these systems at any level violate the laws. Those symmetries are there. There's a lot to be said there, but essentially, the great majority of people—maybe with some exceptions—believe that the laws of physics apply to everything. My brain obeys the laws of physics. Society obeys the laws of physics.
The problem is that the laws of physics are useless at some point in understanding even biology, let alone psychology, sociology, or AI. Why are they useless? Because we have inherited, from the beginning of the universe, a series of spontaneous symmetry breakings. My brain is doing spontaneous symmetry breakings one after another, continuously.
Some of those die out, become irrelevant, or stay the same, but others balloon into very big things. That's actually what evolution is: one of these things after another. Once you have that, the computational irreducibility problem is that, at some level, although in principle this is all predictable and reducible, in practice it isn't.
But here's the point: how do we handle that? Our brains know how to handle it in a way that AI doesn't.
The way they handle it is this: You predict—you computationally reduce everything you can to begin with. I've actually talked with Steve at some length about this, and I'm much more optimistic about how much is reducible than he is. The thing is that your overall universe is not reducible, but it's full of these reducible pieces. In a way, evolution is a cumulative process, and our brain is an accumulation of these reducible pieces.
You want machine learning to discover them, and you want inference to exploit them. But after that, you have no choice but to keep gathering data and using it to inform your predictions, right? In a way, the physics goal of “I give you the initial conditions, and then I just predict”—the Laplace's-demon dream—is a dream. But I think the problem that some of the complex-systems people have not realized is that we don't have to do that.
Ask any engineer, any aerospace engineer using a Kalman filter. What you do is predict just what you need to, as in reinforcement learning, right? You want to have a sense of where you're going, but at every time step, you recalibrate your predictions with the new data that comes in. You only need to predict things well enough to control them, to make them predictable, right?
We humans are always controlling the world to make it more predictable, and this is what robots need to do as well. This is what I'm trying to support with a language like tensor logic. I'm increasingly more of a believer in Hofstadter's concepts: that there are multiple levels of description, and even within a level of description, there may be multiple languages to describe things at that level.
I think part of the lesson is not only that we observe a particular level, and that we try to reduce things and come up with theories at finer-grained levels—higher-resolution theories, or whatever—but that we also observe a certain layer and are able, by whatever sort of miraculous mechanism, to almost pull a theory out of thin air, or abduct one. Here's thermodynamics. Somehow we came up with that, right?
Even if we learn theories at lower levels, or higher-resolution theories, most of the time we don't replace the older ones. Within their domain of operation, Newtonian mechanics is still extremely useful for lots of things that have to do with our scale, our scale of activity. General relativity is useful at a different scale, and quantum mechanics at a different scale.
Tim Scarfe
I'm hearing that tensor logic is a great language for a certain layer of description and for the activities of AI, but you're not arguing that it's the language to replace all other layers, right? You still buy into the idea that there are other languages at different levels?
I'm glad you asked that question. I am absolutely arguing that tensor logic is the language to use at all these layers, and let me give you some evidence for that. Express general relativity in tensor logic. It's tensors, differentials of tensors, and whatnot. Tensor logic does that out of the box.
Do the same thing with quantum mechanics. Do the same thing with all these others, with all the different pieces of AI that I know. Why is that possible, and why does tensor logic do that? Again, I think this gets at a very deep fact about the universe, which complex-systems people and physicists have suspected as well: The universe has this amazing property, without which it would not be comprehensible, that you can have a lot of complexity at one level that then organizes itself into a new level at which a different set of laws applies, right?
In a way, what we do with computers is do that by design, right? But here's the key: What you want is a language in which to express this process—the whole process by which multiple levels get created, by which multiple representations get created, including different representations at the same level.
For example, going back to Herb Simon, many people, at least in AI, have believed that the essence of human intelligence is your ability to switch between representations as the problem dictates. As long as you pick one representation, you've stuck yourself in a box. But at that level, tensor logic is a meta-representation. It's the way to construct representations.
A large language model, to take a very salient example—what has that transformer learned when it looks at all that text? Precisely, I would say, a lot of its power comes from the fact that it has looked at all these different pieces. It's like, as Bill Blake says, it has learned these super-algorithms. There are all these different pieces and different ways of doing things that it has gathered from different places, and it doesn't choose between them.
It's the prompting and the fine-tuning and all that that then pull out the parts that are better for one thing or another. So we absolutely have to do this in AI. I think it also reflects a deeper truth about the universe. I think there are going to be laws of this.
We're not then describing laws of the universe, and I think tensor logic, at least, is my best attempt at having a language in order to do both this type of AI and this type of scientific discovery. I also believe, and I discussed this briefly in the paper, that tensor logic is not going to be just a good language for AI. It's going to be a good language for science in general, for several reasons.
One of them is this, but the other one is that if you look at the difference between the equations on the page and the resulting program from implementing them, often there's a lot of complication. In tensor logic, the tensor equation is almost a symbol-for-symbol translation of the equation on the page. So now you can just do science on a different level.
Also, if you look at scientific computing, it's usually tensor operations with some logic wrapped around them. Tensor logic does the tensor operations and the logic in one language, but more importantly, the logic now becomes learnable. You can learn the logic as well.
Tim Scarfe
Let me challenge you on this. For example, in your paper, when you got to the RNN section, tensor logic can represent RNNs, but then you hacked in star t. You were like, “Oh, I need this little star t here.” What's star t? Well, star t is a virtual index that doesn't create new memory. That's not tensor logic. You hacked in star t because you needed it in order to express RNNs, right?
No—great question. There are 2 very important things to distinguish here. The first is what star t is not: The RNNs also illustrate that it is syntactic sugar, right? You want to express X of t plus 1, right? Tensor logic is Turing-complete, but it doesn't have t plus 1. Adding this is a very simple piece of syntactic sugar. Why wouldn't I do that, right?
Again, there's an 80/20 rule about which of these constructs you want to have. But star t is actually a completely different thing. Star t is there for computational-efficiency purposes. Star t is a hint about how to implement that tensor that saves a ton of memory.
You know this notion of a leaky abstraction: All abstractions are leaky, famously, in computer science. Tensor logic is no exception. For the most part, when you write tensor logic, you don't have to worry about what goes on under the hood, but sometimes you want to. This is precisely one of those things.
The idea of star t is that—we don't have for loops anymore, right? Which is great. Forget all of that. But sometimes I don't want to be computing a new tensor, or even just a new vector, for every new thing that I do, because that would be a waste of memory.
Star t is just saying, “You have 1 vector, and you reuse it at every iteration.” So you have the initial X zero, and then X one overwrites it, right? This is a piece of the language. You can do everything without it, but it would be silly not to use it.
Tim Scarfe
Let me push back on something because you mentioned it twice now, which is the term incompleteness. So your paper relies on Siegelmann's 1995 paper. She herself now, decades later, has admitted that that thing is a total toy that has no practical relevance whatsoever, okay? Because it requires infinite-precision rational registers that encode in a fractal way, et cetera. And by the way, in her paper, all she demonstrated was that under these infinite assumptions she could build a particular RNN that was a universal Turing machine. The problem with you using that for your tensor logic is two things. One, that restricts the field over which you can have your tensors. It must be one of these fields that has infinite precision—so infinite-precision rationals or whatever. I can't use any other fields, like modular arithmetic, which is actually what runs on GPUs, for example. And secondly, it would restrict the actual structure of the weights to her universal Turing machine. Therefore, it wouldn't be a general-purpose tensor logic. Do you realize this problem?
No—no, no. So, actually, there is no problem there. Let me tell you exactly why. Let’s do this in 3 steps.
First of all, Turing completeness doesn’t matter at all, whatsoever, because the only difference between a Turing machine and a finite-state machine is the infinite tape. In the real world, there is no infinite tape.
Tim Scarfe
Why do you keep mentioning it?
That’s part 2. This is actually a very interesting set of questions. Let’s set it aside for a moment and get to that part.
Turing completeness doesn’t matter. What matters is that you want to be able to express any computation that you might want. That’s what matters, right? You might choose a specific language for specific purposes. For something like tensor logic, you want that generality. You have that generality irrespective of Turing completeness. So, this is part 1. We can debate it, but let’s set that aside for just a second.
I don’t get to change the way computer science is, and Turing completeness is a shorthand for universality. I just want to show people that tensor logic is universal. Now, I have a proof that tensor logic is computationally universal that does not rely on the Siegelmann construct.
I chose not to publish it in this paper because it would take too long. The beauty of that is that, in 1 paragraph, I can just say, “Look, the equation in the Siegelmann paper—you can implement it here, and we’re done.” There are so many ways to prove that things are Turing-complete.
I completely agree with you that that construct is ridiculous. It’s silly. It has no practical significance, but the reason I used it is just my way of telling people in 1 sentence that tensor logic is Turing-complete, and why. But the real action is—I’d love for you to share it. I’d love to see the other proof.
Tim Scarfe
Oh, I can. I mean, the other—actually, there’s more than 1 other type of proof that’s possible. Let me tell you what that one is. So, there are 3 ways. There’s the Siegelmann way, right? Another one is that you have a finite control with access to an infinite external tape. That’s a much more reasonable thing, in my view. You have a memory—
Yeah. The memory is infinite, but all that you have to do in tensor logic is know how to access that memory. It gets back to—remember, a Turing machine is a finite control and an infinite tape, right? So, if tensor logic can realize the finite control, which obviously it can, and you give it an infinite tape, then we’re done.
On that note, you can even do it the following way. For example, Dell Sherman has a great paper about this. People have come up with various very simple ways to set up a Turing-universal computer. One of them is a set of rules that sets up that machine. Without going into details, you can just write that set of rules in tensor logic without even having to wake up from your sleep. So, there you go. I totally agree with you.
I often say to people, “A Turing machine is just”—and I really hate to use the word “just” because it doesn’t do justice to Turing, to Alan Turing, and the genius of his creation, the theory of computation—but it’s a finite control with unbounded read/write external memory. I’m totally on board with that.
Absolutely, tensor logic is a finite control, but then you need to add to it these operations to manipulate external memory. So, it’s tensor logic plus some operations to deal with external read/write memory, no? I mean, those operations are just read, write, move left, and move right. That’s all there is.
Tim Scarfe
I know, but that’s an extension of—at least in my view, I don’t know if before you there was such a thing as tensor logic. I’m not sure. I know that a lot of people have talked about tensors for a decade or more, but it seems like some kind of extension to the way tensors are typically used. It’s certainly an extension to the way tensors are used in general relativity. There’s no read/write to external memory in that.
Of course, but that is why tensor logic is more than tensors in mathematics. The tensors that people use in mathematics just don’t do this, but tensor logic does because of the logic-programming side. If tensor logic can do logic programming, then it can do everything that a computer can.
Tim Scarfe
Have you specified fully all the operators in tensor logic somewhere, on a website or something?
There are only 3: tensor projection, tensor join, and univariate nonlinearities. The nonlinearities are crucial. Tensor algebra is multilinear. Algebra is linear; tensor is multilinear, right?
Tim Scarfe
I totally agree. Where do the memory operations fit in there? Are they projections? Are they joins? Are they—
Oh, no, they’re not even projections or joins. Think of a trivial projection where you’re not summing things; you only have 1. That’s what a write is.
Actually, let’s not even worry about tensor joins and projections. Let’s just think about propositional rules. If you want to implement propositional rules in tensor logic, all that you need is tensors with no indices, with 0 indices. So, we’re only dealing with scalars. A write is just a rule that says the target of the writing is on the left-hand side, and what you want to write is on the right-hand side.
Now, to get very quickly to the issue of an infinite memory: What is an infinite memory? An infinite memory is just an infinite vector indexed by the memory address. That’s all it is. So, how do you write this infinite memory in tensor logic? You just have the memory as your tensor on the left-hand side. It’s so simple it almost seems like there’s nothing to think about.
Tim Scarfe
I’ll have to work through some examples. So, just to finish that thought, how do you advance the tape?
Well, you just increment the index. And how do you move it left? You decrement the index. It’s done.
Tim Scarfe
Could we come up with a solid example? I don’t think we sufficiently described the star notation. Roughly, as I understand it, rather than becoming a dimension, it becomes a transition function. We don’t need to model the full trajectory.
Just to give an example, if I wanted to compute, say, the nth digit of π, or approximate it, would I not need to fix the size of the tensors beforehand? Did you see what I mean? The way I understand it, these things have a fixed size. How could it possibly solve unbounded problems?
No, very good. To clarify, the star notation is not a function. The star notation is about an index. For example, if I have a vector, Xᵢ—or a better example, a matrix Mᵢⱼ—this occupies, if i and j are each 100, 10,000 positions in memory.
But if what I do is Mᵢⱼ* on the left-hand side of my tensor equation, then instead of being 100 by 100, it’s just 100. What this is saying is, “Run through i, and for every j, overwrite the result.” You can do this in either dimension, but pick one or the other. It just says, “Keep overwriting the results.” So, you lose your old one.
Let me put it this way: Mᵢⱼ* is actually a vector where the only dimension is i. j is actually just an iterator for a for loop. You see what I’m saying? Concretely, for example, in an RNN, this is what you want because Xᵢ is your vector and the j—let’s call it t—is Xᵢₜ.
At every new step in time, when the state evolves, you don’t want to—I mean, you could, but in general, you just want to overwrite the old state with the new one, as in any state-transition system. Does this make sense?
Tim Scarfe
It does, but you’re describing an accumulator. Do you lose something by losing the history? If you think about it, you’re overwriting what went before with new information, and you’re just unrolling in time. Do you lose anything doing that?
Of course you lose. If you don’t want to overwrite it, then don’t put the star in.
But now, to answer your question about π: How would I compute all the digits of π, in infinite Turing-machine land? I have a vector of the digits of π that has a start but not an end. What the computation in tensor logic does is compute each successive digit.
We didn’t talk about this, but how is inference done in tensor logic? Forward chaining or backward chaining. They are both generalizations of the corresponding operations in symbolic AI.
If you applied forward chaining to a set of rules that computes the digits of π—actually, just 1 rule, because it’s very simple—what it will do is, in each iteration, fill in the next digit of π. If your vector is infinite, this will go on forever, as it should.
If your vector is finite, at some point you run out of memory and you're satisfied with the number of digits, which is what we do with any real computer in the real world.
Tim Scarfe
I don't want to always get us bogged down in Turing issues. I think we should move on, but I think it'd be fun to talk about it more at another time or just to work through some examples. I think I'll probably work through some examples, but I think this was an interesting one. There's a strange attractor with Turing conversations, and normally it goes in the Schmidhuber direction where the universe is finite, there's no difference between an FSA and a Turing machine, and I felt that we actually had some information gain in this conversation.
Well, actually, on that point—and this is a bit of an aside; it doesn't actually have anything to do with tensor logic, so I hope you don't mind me asking—but since we have a computer science professor, I want to run something by you. I always get this kind of pushback from people. I'll say, for example, that autoregressive transformers—and I mean classic autoregression, not extended autoregression, not generalized autoregression, just autoregressive transformers—are not Turing-complete. DeepMind admits this, and they write a paper showing how you can extend them to become Turing-complete.
I'll say something like that, and somebody will be like, “Oh, yeah, but if I can't do 100-digit multiplication with this context size, all I have to do is just have more context, and then I'll be able to do it.” I keep making this point. Here's the crucial difference, right? You brought this up beautifully when you said, “Look, a Turing machine is a finite control with an unbounded read-write memory.” And here's the really cool thing about those Turing machines: they can run in a way where they're churning, churning, churning, churning, and then they say, “Out of memory.” All you have to do is just give them more memory and hit Continue. You don't have to reprogram them. You don't have to retrain them when you've increased their context size, right? That's the whole difference: with a neural network, a traditional transformer, if you increase its context size, you have to go back to the drawing board—you've got to retrain it, right? Because you've run out of memory. Is that a fair point that I'm making?
This is actually extraordinarily simple, and it's incredibly frustrating to me that there's so much confusion about it, starting with computer science and theoretical computer science and now playing out in AI and transformer land. It just boils down to this, right? You said earlier—and I violently agree, so correct me if I misinterpreted it—but you said, “Turing completeness is not important,” but that shouldn't cause us to underrate Turing's achievement.
Absolutely. What was Turing's achievement that we now take for granted? Turing's achievement, for which he is deservedly famous, was to postulate this notion of a universal machine. The amazing thing about computers is that they're universal machines, which in his time was a completely counterintuitive notion. What do you mean, a machine that can do everything? The typewriter can type; the sewing machine can sew. You're telling me there's a machine that can type with one hand and sew with the other? What are you talking about?
This is the genius, right? The first step is that you want to have this property of having a machine that can do anything. This is the foundation of computer science, of computers as a revolutionary technology, right? So, point 1. But point 2—I'm getting to the transformer part, right? Unfortunately, these confusions build on each other and never get resolved. It's one of those symmetry breakings, right? We went down this road of defining things a certain way and worrying about infinity, and now we're stuck there, right? NP-completeness is another example, but ignoring that.
The problem with transformers—the real problem is the following. The thing, for example, that inductive logic programming has and that we want is that you can learn things from very small examples, like children do in elementary school. You learn to do addition on tiny examples, but then, if needed, you can do addition on numbers of any length. Of course, your life is finite. You will never add infinite numbers, but that's not the point. Infinity is just a shorthand for something that's so large it doesn't matter how large it is.
What I want in machine learning is to be able to learn to handle problems, graph structures, knowledge bases, inference problems, whatever, of any size from very small ones. That's the limitation that a lot of these transformers have, and that's the one that you want to fix and can fix, and tensor logic helps you do that.
Just to cap off the discussion about Alan Turing, because I think he deserves a mention: you mentioned that this was the real achievement, this universality. It wasn't just a machine to do typing and sewing; it was even within computation, right? In his time, people didn't know this. They're like, “Well, what if I have a machine that just has a separate read tape and a separate write tape? I don't know. Well, how about if we add 2 write tapes? Does that make it more powerful? What if it's read-write? What if it's just a stack? What if it's lambda calculus? What if it's...”
There were so many myriad L-systems and all these different computational models, right? Nobody knew that they were all equivalent. That was the really remarkable thing. To be fair, Turing wasn't the only one doing things like this, and precisely now we know that there are all these things that are equivalent, and extensions of that power.
Here's actually a really important point, right? The question that has been on my mind for decades is this: a Turing machine is a model of deduction. It's universal deduction. What we're missing to be able to do what the universe does and evolution does is universal induction. What is the Turing machine equivalent for induction, for learning? That's what I'm after. That's what the Master Algorithm is.
I know it exists, and again, just as you can have 1,000,000 different versions of Turing machines that are all equivalent, you can have 1,000,000 different versions of the Master Algorithm that are all equivalent, and that's okay. The point is that first we have to realize that there is one. We have to prove what it does, and then we can refine it with the syntactic sugars and whatnot, and that's all good. But the main point is having gotten the universal induction machine, which I think we are pretty close to.
Tim Scarfe
But Pedro, I know the answer. It's Bayesian tensor logic. No, I'm just kidding.
No, if you're Bayesian, it is Bayesian tensor logic.
Tim Scarfe
This is a good segue because we are talking about reasoning and deduction. Transformers don't really reason, right? I think of them as a kind of collection of fractured bits of knowledge, maybe with a little bit of understanding 2 levels down, but we understand many levels down. And when we do reasoning, what we're doing is respecting all of the constraints of this epistemic understanding phylogeny thing that we have, and that allows us to build new knowledge, right? Because you can build new knowledge, you can create new things when you respect all of the understanding that you already have.
Transformers don't do that, but let's talk about how this works in tensor logic. You have this temperature parameter. For example, you could do something akin to deduction even in an embedding space, right? And certainly with an MLP. This is where I was a bit confused, because I can appreciate that if we have a logical model which is in the domain of certainty, we can do deduction, right?
And then if we have something like an MLP and we learn the weights and we turn this temperature parameter up, it's actually introducing some degree of randomness. Why would that be anything like the kind of logical deductive reasoning we do? Would that not just do what neural networks do now, which is look for similarity in some embedding space, and the type of reasoning it's doing isn't actually semantically meaningful at all?
I actually say that, of all the things in that paper, this is the most exciting and important one: you can do sound and transparent reasoning in embedding space with tensor logic. How come, right? Why is that possible? To give the gist of it, here's the key.
Think of kernel machines for just a second, and the Gram matrix, right? The similarity matrix—what is it, right? You're in feature space, and for every pair of objects i, j, it's the dot product of their feature representations, right? Now, if you embed all your objects, we already know who they are. There's a matrix with the embedding vector for every object, whether it's a word or a token or anything else, right?
Now I can do the dot product of the embeddings of 2 objects, right? Let's suppose they're all unit vectors to keep things simple, right? And now what happens is—and let's, for the moment, say you're not learning the embeddings yet, right? Let's say you just have random vectors, right? Your embeddings are random, right? That's actually already useful for a lot of things, but of course it's not where the action is, right?
And now there's the following very interesting property: the dot product of a vector with itself is 1.
The dot product of 2 random vectors in a high-dimensional space is approximately 0. So, your Gram matrix, your similarity matrix, will be approximately the identity matrix. And now, what happens if I have a tensor logical operation that operates in this way and then has something like a sigmoid nonlinearity? Then what's going to happen is that it's going to clean out that noise, and it turns into the identity matrix.
Now I have all these rules that are just operating in a purely logical mode. They're Boolean tensors going in, meaning relations, and Boolean tensors going out. That way, you can do pure deduction in embedding space with these random embedding vectors. That's already something interesting, but now let's say you learn the embeddings, which of course is the whole point.
When you learn the embeddings, what's going to happen by trying to minimize the loss function is that the embedding vectors of objects about which you tend to make the same inferences will get closer. If I'm saying something about one object and another one is similar to it, gradient descent, to minimize the loss, is going to increase their dot product. So, you're going to wind up with a similarity matrix that has high values for objects that are quite similar—in the limit, 1 on the diagonal—and has low values for objects that are quite dissimilar.
Now, if you turn the temperature parameter, meaning the stiffness of the sigmoid, at one extreme, at 0 temperature, you have a step function. The similarity matrix is discretized back to 0 and 1. So, at the 0-temperature extreme, you have pure deduction. You see where I'm going with this?
Tim Scarfe
I do, but could I challenge that a tiny bit? When we train neural networks, we think reasoning is good when we're building—let's use the LEGO analogy—these blocks. The neural network that we've created is a good one if it represents the world in an abstract, causal way.
I can see how you've framed this as deduction, in the sense that you've got this Boolean operation and you can build from it. But what if you're building on a sandcastle? What if the component—let's say it's an MLP component—doesn't represent the way the world works?
No, that's a very good question. Again, there's more than one thing you can do with tensor logic. One of them is that you can just reimplement existing things like MLPs and transformers. If all you did was reimplement them, they would have all their pros and cons. It's the same thing, just implemented much more elegantly.
What I'm talking about here, and what I talk about in that section of the paper, is doing something different. It's not an MLP, and it's not a transformer. It's actually doing these things where you embed objects, you embed relations in a certain way that follows from the objects, and you embed the rules and the reasoning. This is a different process.
What this different process allows you to do is that, when you raise the temperature, you get to do analogical reasoning. Douglas Hofstadter came up before. I think Douglas Hofstadter would like this because it's analogical. He has this whole 500-page book arguing that all of cognition is just analogy.
Again, this is one of the schools of thought, one of the tribes in The Master Algorithm: reasoning by analogy. You do reasoning by analogy because what happens is that you generalize from one object to an object that has a high dot product with it. Now I get to borrow inferences from similar objects. The higher the temperature, the looser the inferences, and the more analogical the inferences can be.
For example—and again, Douglas goes into this in some of his books—and any mathematician, like Turnstall, I just heard him say this the other day: “Mathematicians reason by analogy. They notice similarities between things. But at the end of the day, you need to have a proof.”
In tensor logic, in this particular scheme of embedding and reasoning in embedding space, this is just simulated annealing. You start out with a high temperature, being very analogical, and then you lower it. At the end of the day, you have a proof. It's a deductive proof that is guaranteed to be correct, but you couldn't have gotten to it because the search space is so large without the analogical part.
Tim Scarfe
Okay, I understand what you're saying. You can generalize reasoning outside the domain of certainty. But the reason I'm asking is that the reason we have metaphor and analogy is because there's this incredible process of evolution and intelligence. It's led to the coarse-graining of all these concepts that we use in our language, and there's this rich, beautiful phylogeny that represents the causal reality of what's happened.
Why is statistical similarity the same thing as analogy?
It's not. Again, I skipped over some steps here. It isn't. The most powerful type of analogy—kernel machines, in some sense, are the least powerful type of analogy—is just, “Here's a similarity,” or nearest neighbor. I have a distance function. That's not really where the action is.
The action is in what's called structure mapping. Structure mapping was proposed by Dedre Gentner, where you solve a problem by mapping its structure to the structure of problems that you know. The canonical example is Niels Bohr's model of the atom, which he came up with by analogy between an atom and the solar system. The nucleus is the sun, and the planets are the electrons. It turns out to be a bad analogy, but it was crucial in the development of physics.
There's also this whole subfield of AI called case-based reasoning, where I might be a help desk. You come up with a problem, and I don't try to solve it from scratch because I don't need to. That would be a waste. I go to my database of similar cases, find one, and then tweak it.
Structure mapping is an extraordinarily powerful thing, but it's the combination of similarity and compositionality, which kernel machines per se don't have, but tensor logic does. The point in tensor logic is that you have all the power of kernel machines, but all the compositionality of symbolic AI.
The structure mapping just comes out of the box. You don't need to do anything more to have structure mapping and all the power of analogical reasoning that comes with it.
Tim Scarfe
Can I suggest that a good analogy is to ad-lib? Do you think that's fair? You've got the general structure there, and you can plug parts into the blank spaces and get a solution, right?
That's one mode in which things can function. The whole process of structure mapping, or of case-based reasoning, can actually be very rich. I can combine, for example, 2 big pieces, but that's one example.
Tim Scarfe
Yeah, that's fair. It has this nice nested-structure property. Since we're on this topic, let me ask you about something that I was confused about in the paper. I don't understand your connection between hallucination and deduction, or determinism, because in my mind, I can set the temperature of GPT to 0 and it still hallucinates. I can have a poor deductive system that hallucinates all kinds of things.
So, to me, those are separate problems. Where was I misunderstanding?
Very good. Precisely, one of the problems with GPT is that it hallucinates even when you set the temperature to 0. What the hell? I want to have a mode—right? Not me, but every Fortune 500 company, if it's going to use AI, needs to have a mode where the logic of the business is just to behave. The security isn't violated, the customer doesn't get lied to, and so on. We've got to have that, or AI will not take off.
Transformers can't do that. Tensor logic can do that precisely because, in this reasoning-in-embedding-space mode that I just described, if you set the temperature to 0, it does purely deductive reasoning. By the way, the temperature can be different for each rule.
I think this is what almost all applications are going to have: there are some rules that are either mathematical truths or logic that you must guarantee will not be violated. They are the laws, and those have infinite temperature. Then there are all these other rules that involve more qualitative reasoning, more accumulating evidence, and perhaps things that you mine from the web. Those will have higher temperature.
That temperature parameter can be learned for some rules and fixed for others. Now you have this whole spectrum between the deductive and the more qualitative—or even fantasizing, truly hallucinating—at the far end of the high-temperature range.
Precisely the point that I'm making in the paper is that, with LLMs, the best thing you can get at 0 temperature is still a lot of hallucinations. Then there are things like RAG, but all they do is retrieve, and even then you still hallucinate. Compare tensor logic in this mode with RAG. It doesn't just retrieve things. It computes the deductive closure of your knowledge, which is an exponentially more powerful thing to have. And with zero hallucinations.
Tim Scarfe
Well, it is if the model represents the world. What does hallucination mean? Or, actually, what does slop mean? My definition of slop is when a creative artifact is produced by something that doesn't understand. If I understand the domain deeply, that artifact looks incoherent to me because it was generated by a process that doesn't understand the world.
Isn't it even the same with Tensor Logic? Deduction is great, but if the model isn't a good one, wouldn't that just be a hallucination as well?
Oh, absolutely, but let's make some distinctions here. The only claim I'm making here, because it's the only one you can make, is that Tensor Logic at zero temperature in this mode will give you the soundness properties that logic has. Soundness in the technical sense of soundness.
All that means is that you only reach conclusions that truly logically follow from the premises. You don't say anything about whether the premises are valid or not. If the premises were hallucinated, so will the conclusions be. There's no magic there.
That is a very important property to have. Again, if I give a transformer a bunch of true facts, it still hallucinates. That's what I can guarantee will not happen in Tensor Logic. Coming up with the true facts is a different part of the game. You can write them down, you can learn them, and you can refine them. You never know for sure if you have the perfect model. Of course, that's more the machine learning and knowledge acquisition part.
I do think I have a very important guarantee here of non-hallucination, but it's not a guarantee that the model you're working with came from the real world. That's a whole other neck of the woods.
Tim Scarfe
Who's going to adopt this first? How are we going to bootstrap this as a community? How do you see this progressing?
Good. The last section in the paper discusses adoption, what needs to happen, and things like that. Let's suppose that everybody agrees Tensor Logic is a beautiful, perfect language and what we need for AI. Just for that reason, it would not be enough to make it take off, sadly. People are still using COBOL these days. I rest my case.
Legacy is an irony in computer science, or in the information technology industry. It moves faster than anything else, but at the same time, things never die. You can't kill them. You can't kill COBOL.
I like Python. I program in Python. It's very nice in many ways, better than Fortran for some things, and so on. Even if it was never—or NumPy, if you will—you get the point. For AI, it's just a terrible thing, but I'm a Python programmer. I'm not going to rewrite all my code. Forget that.
So what is going to make it happen? We can look at what has made this happen in the past. There are several things. For example, look at how Java took off. Java took off at the time of the internet because it was the language of networking, allegedly. You could debate that, but people wanted to do things that were very hard to do with things like C and C++. And so Java took off.
Tim Scarfe
It was the language of embedded programs and web browsers. That was the only option we had, right?
Exactly. There are big arguments about this, but they aren't relevant to us here. The point I'm trying to make is that we're in a different ballgame now.
Why did languages like Lisp and Prolog fall out? They were better for AI than Fortran, C, or Java. They were niche languages. The network effects of the more widely used languages and all their surrounding aspects completely overrode that. We understand that very well now; people didn't in the '80s.
Now, the big technology, the center of everything, is AI. If you have a better language for AI, that is the one that is going to have the biggest users. Moreover, if you have a language that solves the big pains, that's what makes people adopt a new language—or a new anything, like a new app. It needs to solve some big pain.
Is there a big pain that Tensor Logic solves? Hell yeah. It potentially solves hallucination. It solves opacity. We're in a world right now where there are multibillion-dollar corporations and systems driven by this black box. I've talked with CEOs of big tech companies who say, “I can't sleep at night because I don't know what this thing is going to do. The people who trained it have left the company, and who knows what it will do?”
If we can make a dent in that, people will convert to it very quickly. I also think that when people experience how easy Tensor Logic is to use compared to the big pile of stuff that lies under PyTorch and whatnot, they will be very motivated to migrate quickly.
There are several other things, such as developing the open-source community and vendor competition. But one important thing is that Tensor Logic is ideally suited for AI education. It's one language with very little extraneous stuff, and you can teach the entire gamut of AI very well and do the exercises. It will be a language that the professors, the TAs, and the students will like.
History shows, going back to things like Unix, that if you have something that takes off in computer science education, people go into industry and say, “I want to use this because it's what I like.” A generation later, it's what everybody is using.
One more thing is that the transition to Tensor Logic from Python doesn't have to happen all at once. You can have, for example—and I already have one, actually, as do others—a preprocessor in Python. Again, because it's very easy to do, you read the paper and you can write it in the next 30 minutes. You can write a preprocessor in Python. All it does is make a one-to-one mapping between the syntax of Tensor Logic and einsum.
Making things efficient, as we discussed, is another matter. But from the point of view of developer uptake, there's a long history of people doing this with different languages. You have a preprocessor that lets you write tensor equations, and then it converts those equations into PyTorch or just NumPy, in Python. You do everything else in Python that you did before. You don't lose anything; you don't lose any existing code. It's just that a set of things, and in particular reasoning, have now become much easier than they were before.
Then, once you have this little lollipop, you think, “I can do this, and let me have that piece of syntactic sugar.” Before you know it, people are saying, “I don't need all that Python stuff anymore. I'd rather live in the Tensor Logic world.”
Tim Scarfe
You said that Tensor Logic is good for AI education, and Tensor Logic is a declarative language, which means it's the “what,” not the “how.” It's this incredible coarse-graining that screens off a lot of unnecessary detail. But is it unnecessary? I guess that's the question. Do you think people learning about AI should know how the underlying things work? Certainly, folks working at Google might need to do some domain-specific optimizations for certain components of the machine behind the scenes. Do you think we can screen off all that detail?
Great question. Actually, let me start by correcting something. Tensor Logic, like Prolog and Datalog, has both declarative and procedural semantics. You can look at a tensor equation. That's actually the whole beauty of logic programming, in some sense: a Tensor Logic equation is like an equation, like Einstein's equation. It's a statement about the world.
But you can also look at it and treat it as a function call. The left-hand side is the call, and the right-hand side is the body, which is a bunch of other calls and the way to combine them. In fact, in my experience using Tensor Logic so far, I tend to use it in procedural mode. It's a set of equations, a bunch of statements, like you would have in any imperative language. It's very important to bear that in mind.
To the heart of your question, which I think is very important: when you're teaching people something, I would actually say this is the tragedy of computer science education. From high school to introductory courses to the most advanced subjects, you want to teach people the beauty of what they can do and the essence of the algorithms and so on. But then—and particularly the students—they spend all their time bogged down in all this crap.
All these details where you get the semicolon wrong and the program doesn't work anymore, and they hate it. They decide that computer science is not for them, or at best, they waste 10 times more time than they should, right? So, precisely, the whole point of having the right abstraction is to avoid that. I would say this is one of the best features of Tensor Logic: to do that for AI.
But you also say, correctly, that a lot of the time you need to go beyond that level of abstraction, for example, from the point of view of efficiency and a lot of other things. But I would say—and again, we won't know until Tensor Logic is used widely and we see what happens—that Tensor Logic is a language that, at some level, is like C, right? It's very low-level. The beauty in my mind—again, this gets back to the multiple levels of abstraction—is that you can use it to say very high-level things.
You can also use it to express the lowest-level possible computations, right? A tensor equation is something that you can map onto a GPU with almost no change, and then optimize the heck out of it. In fact, I've joked with folks at NVIDIA that CUDA is a nice moat, but Tensor Logic could be the end of that moat.
Tim Scarfe
I sometimes feel like—and I'm not sure exactly how much money was spent on bigger and bigger transformers, deeper and deeper, wider and more data, and whatever, more-parameter transformers—but it's got to be a lot, like a trillion dollars or something like that. I feel like sometimes we spent a trillion dollars to learn, yet again, lessons that people could have learned if they'd taken certain basic courses in computer science. I'm wondering if you sometimes feel like that, and what lessons, if any, you think people should have known before spending a trillion dollars.
I violently agree with that. In fact, the paradox of the current moment in AI is that, on the one hand, this is super exciting, right? This is what we've worked all our lives toward. It's like the dream is happening. I used to tell people, when I went into grad school, that one day machine learning was going to take over the world, and they'd be like, "What?" And I'm like, "See, it is taking over the world. There, take that."
On a more serious note, transformers are a great leap forward, and anybody who's used a chatbot is like, "Wow, look at the things this can do. This is great." But at the same time, the sheer amount of wastefulness, stupidity, and ignorance going on is just unbelievable. It's like, "Why are you reinventing things?" For example, I've talked with people at OpenAI who do the reasoning. Many of them are very good people, so I'm not trying to pick on anybody, but it's like, "Oh, what is reasoning? We need to figure that out." And then they say a bunch of stuff that is completely wrong.
I'm thinking to myself, "Why don't you spend an afternoon reading a couple of chapters of Russell and Norvig and save $100 billion in wasted compute? Please, just do that," right? Part of what I'm trying to do with Tensor Logic is make things go in that direction, because the current direction is just too damn painful. And it's not just that it's painful. This is going to end badly, right?
Tim Scarfe
Oh, yeah.
In a way, spending all this money on data centers is not wasted, because it's not like the fiber that went dark, right? We in AI have an appetite for unlimited compute. But they're spending all this money prematurely on stuff that isn't ready for that yet, right? The demand is probably not going to be there, and we're going to look back and go, "Wow, 99.9% of that compute was completely wasted."
That's because of a lot of the reasons that we've been talking about, including that you didn't know how to do reasoning, so you brute-forced it, et cetera. We have to change the direction of this ship. It's like that well-known quote from Matt Damon in Good Will Hunting, to paraphrase it: "You've wasted a trillion dollars on an education you could have got for a buck fifty in late fees at the library."
Tim Scarfe
Exactly. Exactly. Well, Professor Pedro Domingos, it's an absolute honor to have you on the show. Thank you so much for joining us.
Thanks for having me. Thank you. Always a pleasure.