Binary Balanced Tree RvNNs (BBT-RvNNs) enforce sequence composition according to a preset balanced binary tree structure. Thus, their non-linear recursion depth is just $\log_2 n$ ($n$ being the sequence length). Such logarithmic scaling makes BBT-RvNNs efficient and scalable on long sequence tasks such as Long Range Arena (LRA). However, such computational efficiency comes at a cost because BBT-RvNNs cannot solve simple arithmetic tasks like ListOps. On the flip side, RvNNs (e.g., Beam Tree RvNN) that do succeed on ListOps (and other structure-sensitive tasks like formal logical inference) are generally several times more expensive than even RNNs. In this paper, we introduce a novel framework -- Recursion in Recursion (RIR) to strike a balance between the two sides - getting some of the benefits from both worlds. In RIR, we use a form of two-level nested recursion - where the outer recursion is a $k$-ary balanced tree model with another recursive model (inner recursion) implementing its cell function. For the inner recursion, we choose Beam Tree RvNNs (BT-RvNN). To adjust BT-RvNNs within RIR we also propose a novel strategy of beam alignment. Overall, this entails that the total recursive depth in RIR is upper-bounded by $k \log_k n$. Our best RIR-based model is the first model that demonstrates high ($\geq 90\%$) length-generalization performance on ListOps while at the same time being scalable enough to be trainable on long sequence inputs from LRA. Moreover, in terms of accuracy in the LRA language tasks, it performs competitively with Structured State Space Models (SSMs) without any special initialization - outperforming Transformers by a large margin. On the other hand, while SSMs can marginally outperform RIR on LRA, they (SSMs) fail to length-generalize on ListOps. Our code is available at: \url{https://github.com/JRC1995/BeamRecursionFamily/}.
翻译:二叉树递归神经网络(BBT-RvNNs)根据预设的平衡二叉树结构强制执行序列组合,其非线性递归深度仅为$\log_2 n$($n$为序列长度)。这种对数级缩放使BBT-RvNNs在长序列任务(如长程竞技场LRA)上高效且可扩展。然而,这种计算效率是以牺牲性能为代价的——BBT-RvNNs无法解决如ListOps等简单算术任务。相反,能在ListOps(及其他对结构敏感的任务如形式逻辑推理)上取得成功的RvNNs(如束树RvNN),其计算成本通常甚至数倍于经典RNN。本文提出新型框架——递归中的递归(RIR),旨在平衡二者的优缺点,实现兼收并蓄。RIR采用双层嵌套递归形式:外层递归是$k$叉平衡树模型,其细胞函数由另一个递归模型(内层递归)实现。内层递归选用束树RvNN(BT-RvNN),为此我们进一步提出束对齐新策略。整体而言,RIR的总递归深度上界为$k \log_k n$。基于RIR的最优模型首次在ListOps上展现出高($\geq 90\%$)长度泛化性能,同时具备足够可扩展性以在LRA长序列输入上训练。在LRA语言任务精度上,该模型无需特殊初始化即可与结构化状态空间模型(SSM)竞争——大幅超越Transformer。尽管SSM在LRA上略优于RIR,但它们在ListOps上无法实现长度泛化。我们的代码开源在:\url{https://github.com/JRC1995/BeamRecursionFamily/}。