IBM Research announced on December 4, 2026 that it was open sourcing CoFrNets, a PyTorch implementation of neural-network layers inspired by continued fractions, and reported competitive or better performance with 30% to 50% fewer parameters in recent language-model experiments. The code can replace feed-forward or attention layers in language models.
The public repository provides an installable cofrnet package, a CoFrNet module that can serve as a drop-in replacement for a feed-forward layer, and examples spanning univariate functions, tabular classification and language modeling. Developers can replace every multilayer perceptron or attention layer, or only selected ones to create hybrid models. Most of the code is under Apache License 2.0, while the adapted nanoGPT example remains under its MIT License.
Rewriting Continued Fractions for Neural Networks
A continued fraction nests divisions within divisions, and CoFrNets turn that ladder into a learnable neural-network function. IBM says the function class can represent complicated shapes with relatively few parameters. The design also creates two practical obstacles: divisions do not map efficiently onto modern hardware, and denominators close to zero can produce extremely large activations that destabilize training.
The repository addresses the first problem with continuants, polynomials that rewrite the continued-fraction calculation. A ladder with d levels would naively need d divisions; the new form instead uses multiplications and additions before taking a ratio, leaving at most one division per ladder regardless of depth. Most of the computation consequently becomes matrix arithmetic, which is better suited to GPUs.
Stability required separate changes. Earlier CoFrGeNet models were trained incrementally, layer by layer, adding complexity to standard pretraining. The NeurIPS 2026 paper describes a logarithm-exponential rewrite of division that stabilizes deeper ladders without that procedure.
A separate Spec-CoFrGeNet preprint submitted on November 24, 2026 addresses the epsilon parameter previously used to prevent division by zero. Choosing that lower bound made optimization non-smooth and could affect final performance. The authors say their spectral reparameterization of the partial denominators removes the need to sweep epsilon values and eliminates incremental training.
Reported Results Across Model Types
The NeurIPS experiments cover GPT-2, Llama 3, Mamba-2 and nano Llama-MoE. The authors report that the non-expanding gated architecture performs similarly or significantly better than the earlier continued-fraction design, with higher throughput. The paper is scheduled for a poster session on December 8, 2026.
The Spec-CoFrGeNet results extend the comparisons to GPT-2 XL, nano Llama-MoE and Granite. The authors report performance comparable to the original feed-forward-based architectures and, in most cases, better than the incremental-training baseline. They also describe the first image-generation demonstration for continued-fraction networks: on a Diffusion Transformer, their approach achieved comparable performance to the feed-forward model with about 30% fewer parameters and significantly outperformed the previous incremental method.
An earlier CoFrGeNet study shows the scale of the language-model tests behind this line of research. Its GPT-2 XL and Llama 3 experiments used models with 1.5 billion and 3.2 billion parameters, respectively; the authors reported competitive and sometimes superior downstream performance with shorter pretraining. That work relied on the incremental procedure the newer papers remove.
Developer Access and Current Limits
The software requires Python 3.10 or newer and PyTorch 2.0 or newer. Introductory examples fit univariate functions and train a tabular classifier on a CPU, while the language-model examples range from a small character-level Shakespeare model to a 124-million-parameter GPT-2 experiment on OpenWebText that requires GPUs. The repository also documents a current limitation: some gradient tests are skipped by design because its Gershgorin reparameterizations do not support learned partial numerators.
IBM says it observed larger performance gains in mixture-of-experts architectures, but presents integration into additional open and proprietary LLMs as future engineering work to test whether the parameter efficiency holds. It also lists gradient-free optimization, scientific-data modeling, surrogates for systems described by partial differential equations, and possible optical or quantum computing implementations as research directions rather than completed capabilities.
The release gives outside researchers a direct way to examine the central trade-off: whether continued-fraction layers can preserve model quality with fewer parameters across a broader range of models and training setups.
Credit: Source link

























