IBM open-sources CoFrNets to test smaller language-model layers

IBM’s public PyTorch implementation lets researchers test a feed-forward layer design that the company says matched or improved performance with 30–50% fewer parameters in its gated experiments.

Editorial cover: PyTorchEditorial cover: PyTorch
Company marks identify their owners. Reference only; no endorsement.

IBM Research released the source code for Continued Fraction Networks, or CoFrNets, on December 4. The public repository gives language-model researchers a PyTorch implementation they can use to replace a model’s feed-forward layers and measure what happens to quality, parameter count and training speed. IBM reports competitive or better performance with 30–50% fewer parameters in experiments using its gated design. The percentage describes IBM’s experimental results, and the release makes the underlying approach available for teams to test on their own workloads. IBM Research announcement

Two language-model runs use the same training data and attention. One uses a standard feed-forward layer and the other uses a CoFrNet layer. Compare parameter count, held-out loss and training throughput.Two language-model runs use the same training data and attention. One uses a standard feed-forward layer and the other uses a CoFrNet layer. Compare parameter count, held-out loss and training throughput.
IBM’s public PyTorch implementation enables a controlled comparison of a standard feed-forward layer and a CoFrNet replacement. The graphic shows an experimental design.

IBM Research’s CoFrNets open-source announcement.
IBM Research’s announcement page for the CoFrNets open-source release. · Original source

What IBM released

The repository contains a PyTorch module for CoFrNet layers and examples for fitting simple functions, classifying tabular data and training language models. The language-model example uses nanoGPT training code in two settings. A character-level Shakespeare example runs on a CPU, and a GPT-2 124M configuration for OpenWebText requires GPUs. The example supports swapping the feed-forward network, attention or both. The repository lists Apache 2.0 for its code, with an MIT license for the adapted nanoGPT example. IBM CoFrNets repository

For a team studying the feed-forward result, the most informative first comparison is a stock model against a version that changes only the feed-forward layer. Attention mixes information across token positions, while the feed-forward network transforms each token’s representation. Keeping attention fixed makes it easier to attribute any change in quality or throughput to the feed-forward replacement. The option to swap attention gives researchers a separate experiment once they have that baseline. For more on how pretraining experiments are judged under a budget, see our coverage of PreTrainBench.

Why training stability matters

A continued fraction nests divisions inside one another. CoFrNets use learned functions to supply the terms of that fraction. As IBM explains, a straightforward implementation can turn a small denominator into a very large activation, and repeated divisions are a poor fit for modern GPU hardware. The repository describes an algebraic rewrite that evaluates a ladder with additions and multiplications followed by at most one division, regardless of the ladder’s depth. IBM Research announcement · Implementation notes

The gated architecture paper describes a further change that expresses division using logarithms and exponentials. The authors report that this let them train deeper CoFrNets without the incremental, layer-by-layer schedule used in prior work. They tested the design across GPT-2, Llama-3, Mamba-2 and a small Llama mixture-of-experts architecture. The abstract reports similar or significantly better performance and higher throughput compared with the authors’ earlier continued-fraction architecture. That comparison has a specific baseline. A team evaluating CoFrNets against its current feed-forward layers still needs a direct measurement on its hardware. NeurIPS 2026 paper

What the parameter result leaves open

Parameter count and training throughput answer different questions. A smaller set of weights can reduce weight storage at a given precision. How long the model takes to train also depends on the operations in the replacement layer, how well the hardware executes them and how much training the model needs to reach a target quality. Serving performance adds another set of measurements, including latency at the sequence lengths and batch sizes a team expects to handle.

A comparison on the same data, accelerator and token budget can show whether the two models reach similar held-out loss. Recording throughput and peak memory alongside parameter count then reveals whether weight savings translate into a practical training benefit. Measuring time to the same held-out loss answers a different question, since a model that processes tokens quickly can still require more of them to reach the target. IBM’s release gives researchers the code to run those comparisons, starting with a documented language-model example and moving to the architectures and workloads where smaller layers would matter most.

Sources

  1. IBM is open sourcing CoFrNets - IBM Research
  2. GitHub - IBM/CoFrNets: Continued Fraction Networks · GitHub
  3. [2611.26835] Non-Expanding Gated Continued Fraction Architecture for Feedforward Layers in Language Models