Non-Expanding Gated Continued Fraction Architecture for Feedforward Layers in Language Models

Amit Dhurandhar, Vijil Chenthamarakshan, Karthikeyan Natesan Ramamurthy, Dennis Wei, Rahul Nair

It’s late, your eyes are a bit heavy, and you’re probably wondering why we’re still throwing more parameters at Large Language Models (LLMs) when our GPUs are already screaming. The paper "Non-Expanding Gated Continued Fraction Architecture for Feedforward Layers" offers a refreshing alternative: what if we could make models significantly smaller and faster without losing the "magic" of their performance?

TL;DR

The authors propose replacing the bulky, parameter-heavy feedforward layers in LLMs with a lean architecture inspired by the mathematical concept of continued fractions. By avoiding the usual "hidden state expansion" and using a clever log-exponential trick to stabilize training, they achieved up to 50% parameter savings and higher throughput while maintaining or even improving accuracy across Transformers, Mamba, and Mixture-of-Experts (MoE) models.

What Problem Does This Paper Address?

In almost every modern AI architecture—from the ubiquitous Transformer to the newer Mamba state-space models—the Feedforward Network (FFN) is the biggest "parameter hog." Traditionally, these layers take an input, blow it up to 2x or 4x its original size (the "expansion factor"), apply a non-linearity, and then shrink it back down.

While effective, this expansion is expensive in terms of memory and computation. Previous attempts to use "Continued Fraction" networks (CoFrGeNets) showed promise for parameter efficiency, but they were notoriously finicky to train, often requiring complex "incremental" training schedules to prevent the math from exploding (specifically, the division operations). This paper aims to make these efficient layers a stable, "drop-in" replacement for any standard LLM.

Methods

The authors introduce CoFrGeNet-FNG (Non-expanding Gated). Here’s the recipe:

  1. Non-Expanding Gating: Instead of expanding the hidden dimension, they use a gated linear unit (GLU) style setup that stays within the original embedding size. This keeps the parameter count low.
  2. The "Ladder" Structure: They use continued fractions—a mathematical way of representing numbers as a nested "ladder" of divisions (e.g., $a_0 + 1/(a_1 + 1/(a_2 + \dots))$). In this architecture, the $a_k$ terms are linear functions of the input.
  3. The Log-Exp Trick: Division is a nightmare for gradients because it can lead to "poles" (dividing by zero) or massive spikes. The authors bypassed this by rewriting the division $A/B$ using logarithms and exponentials: $$\text{sgn}(A)\text{sgn}(B) \cdot \exp(\log|A| - \log|B|)$$ This simple change makes the math "smooth" enough for standard optimizers like AdamW to handle without special training tricks.
Figure 1: Above we see our continued fraction inspired architecture that can replace feedforward layers in dense as well as MoE architectures. Our architecture performs a non-expansive gating of the input that then passes through an (ensemble of) continued fraction ladders. The fact that we do not expand the hidden representation and each layer of our ladders requires only a linear number of parameters we obtain significant parameter savings over typical (gated and vanilla) feedforward layers leading to dense models that are ≈2

Datasets

The models were put through the ringer on several massive datasets:

  • Pre-training: OpenWebText (OWT), GneissWeb 35B (GW), and a 2-trillion token mix (Docling) for the more modern Llama and Mamba variants.
  • Evaluation: The GLUE benchmark for general language understanding, and a suite of zero-shot tasks including OpenQA, PIQA, ARC-Easy, HellaSwag, and WinoGrande.

Key Insights and Ideas

  • Arithmetic Intensity over Raw Count: Even if the new layer has a few more parameters than previous "continued fraction" versions, it’s actually faster. Why? Because it uses a single ensemble of ladders. The hardware only has to read the input once, leading to better "arithmetic intensity"—a fancy way of saying the GPU spends more time calculating and less time waiting for data to move.
  • Stability is a Drop-in Feature: By fixing the division problem with the log-exp trick, the authors turned a "research curiosity" into a practical tool. You don't need a special training recipe anymore; you just swap the layer and hit "train."
  • MoE Synergy: The savings are most dramatic in Mixture-of-Experts models. Since MoEs use many "experts" (which are just FFNs), replacing them with these leaner continued fraction layers cuts the model size nearly in half.

Key Results

  • Parameter Efficiency: Dense models (like GPT-2 and Llama-3) saw a 33% reduction in parameters. Mixture-of-Experts (Llama-MoE) reached 50% savings.
  • Performance: Despite being smaller, the CoFrGeNet-FNG variants often outperformed the original, larger models. For example, on the Llama-3.2B architecture, the continued fraction version showed better zero-shot accuracy on several benchmarks (see Table 4 in the paper).
  • Speed: Throughput (tokens per day) was consistently higher. For Llama-3, the CoFr variant processed 306B tokens/day vs the original's 235B.
  • Convergence: As shown in Figure 2, the new architecture actually converges to a lower loss faster than the original Llama-MoE.
Figure 2: Validation loss for Llama-MoE and CoFrGeNet-FNG as a function of the number of training tokens. As can be seen the loss for CoFrGeNet-FNG converges faster and to a lower value (2.92 vs 3.01) than the original model qualitatively consistent with the benchmark results in Table 6.

Limitations and Future Work

  • Standard LLM Woes: The authors note that their models are still susceptible to the usual suspects: prompt injection and hallucinations. Changing the FFN doesn't magically solve the "truthfulness" problem.
  • Implementation Gaps: To get the absolute maximum speed, the authors suggest writing custom Triton kernels (specialized GPU code), which they haven't done yet.
  • Scale: While they tested on 3B-class models, the behavior on 70B+ or trillion-parameter models remains an open question.
  • Interpretability: Continued fractions are mathematically "neat." The authors hope this might eventually lead to models that are easier to audit or understand internally than standard "black box" MLPs.

Summary updated

Abstract

Recent work has shown that continued fraction inspired neural architectures (CoFrGeNets) can be highly parameter efficient yet performant for language modeling. In this work, we revisit continued fraction-based channel mixing with the goal of improving its performance and simplifying integration into standard pre-training protocols for language models. We achieve this by two simple yet critical contributions: i) we propose a novel non-expanding gated continued fraction inspired architectural component to replace feedforward layers in established language model architectures that may use vanilla multilayer perceptrons or gated linear units or (vanilla/gated) experts in mixture-of-experts (MoE) type architectures. ii) We propose a way to re-implement divisions -- the non-linearity in these architectures -- in terms of logarithms and exponentials. By experimenting on different language modeling architectures such as GPT-2, Llama-3, Mamba-2 and (nano) Llama-MoE we find that our proposed architecture performs similarly or significantly better than the continued fraction architecture proposed in prior work along with having higher throughput. In addition, our re-implementation of divisions makes training of deeper CoFrGeNets stable without the need for incremental training which was proposed in prior work as a means to stabilize training, but added notable complexity to existing large language model training implementations. Code is available at http://github.com/IBM/CoFrNets
BibTeX
@inproceedings{dhurandhar2026non,
  author = {Amit Dhurandhar and Vijil Chenthamarakshan and Karthikeyan Natesan Ramamurthy and Dennis Wei and Rahul Nair},
  title = {{Non-Expanding Gated Continued Fraction Architecture for Feedforward Layers in Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=csNiporPZm},
}
Figure