IBM's CoFrNets: Continued-Fraction Layers That Beat a 4x FFN With a Third Fewer Parameters

· AI & Models · IBM Research · Model Architecture · Open Source · LLM Efficiency · NeurIPS 2026

IBM Research open-sourced CoFrNets, a PyTorch layer that swaps a transformer's feed-forward network for a continued-fraction ladder: GPT-2 XL shrinks from 1.5B to 985M parameters with better perplexity, and Llama-MoE halves in size. The catch is that every result tops out at 3.2B parameters and come

IBM's CoFrNets: Continued-Fraction Layers That Beat a 4x FFN With a Third Fewer Parameters

IBM open-sourced a continued-fraction layer that replaces the FFN inside GPT-2, Llama-3, Mamba-2 and MoE blocks.

Executive Takeaway: A continued-fraction ladder matches or beats a 4x-expanded MLP while costing parameters linear in ladder depth instead of quadratic in width. On GPT-2 XL the swap cuts the model from 1.5B to 985M parameters (-34%), improves WikiText-103 perplexity from 17.50 to 16.13, and drops training cost from 9.1 to 6.1 GFLOPs per token.

The mechanism is not a new activation. It is a re-parameterisation: a nested division chain whose depth buys expressivity, rewritten as continuant polynomials so a whole ladder needs one division, then as log/exp so the epsilon fudge factor disappears. The FFN's job, channel mixing, stays; the 4x hidden expansion does not.

Header art from IBM Research's CoFrNets open-source announcement
Header art from IBM Research's CoFrNets open-source announcement

IBM Research: IBM is open sourcing CoFrNets

1 · What Actually Changed

The FFN's 4x expansion is replaced by a depth-d ladder of affine maps plus one reciprocal.

A ladder instead of a wide matrix

Nested reciprocals approximate sharp functions with few weights

Each rung is a_k = w_k · x, and the ladder reads a_0 + 1/(a_1 + 1/(a_2 + …)).

  • Why it is compact: depth adds representational power without widening the hidden state.
  • Why it was slow: a naive depth-d ladder needs d divisions, and small denominators explode activations.

One division per ladder

Continuants collapse the chain into add/multiply plus one ratio

The continued fraction equals a ratio of continuant polynomials K_{d+1}/K_d, so the reciprocal count drops from d to 1 and the operation GPUs handle worst largely disappears.

Figure 3 from the paper: two CoFrNet ladder ensembles whose outputs multiply element-wise
Figure 3 from the paper: two CoFrNet ladder ensembles whose outputs multiply element-wise

Log/exp kills the epsilon knob

Division becomes exp(log a − log b), stabilising deep ladders

Earlier versions needed a tuned epsilon to avoid divide-by-zero, plus layer-by-layer incremental training. The 2026 rewrite removes both: GPT-2 XL at depth 5 reaches 17.14 WikiText-2 perplexity with or without incremental training, versus 26.71 without the trick.

Non-expanding gate (FNG)

p to 2p to a Swish gate back to p, with no 4x blow-up

The input is read once, gated, and fed to a single ladder ensemble whose output projects back to p. Parameters scale like L·p·(d+1) rather than the 8p² of a 4x MLP, which is where the savings come from.

2 · Benchmarks & Landscape

Every number below is vendor-reported from IBM's own pre-training runs, not an independent replication.

GPT-2 XL: smaller and better

MetricGPT2-xlFNG 985M
Parameters1.5B985M (-34%)
WikiText-103 ppl17.5016.13
WikiText-2 ppl18.3017.14
GLUE MNLI86.8987.26
GFLOPs per token9.16.1
Pre-train days7.97.6

Throughput on 128 H100s

Fewer FLOPs per token means more tokens per day

MoE is the real prize

Four experts replaced: 403M to 204M, with lower loss

Llama-MoE drops to half the parameters and still improves validation loss (2.92 vs 3.01) plus 6 of 8 zero-shot benchmarks. Savings approach the expansion factor as expert count grows, because a larger share of each block becomes CoFrNet.

FFN options, side by side

Layer typeParamsMixing
Dense MLP (4x)8p²pointwise
Gated MLP (SwiGLU)6p²pointwise
MoE (E experts)E·8p²sparse
CoFrNet FNGlinear in d,L,pladder

3 · Limits & Counterarguments

The paper stops at 3.2B parameters; nothing here shows the curve holds at 70B.

Untested above 3.2B

Scale claims rest on GPT-2, Llama-3.2B, Mamba-2 and Llama-MoE

IBM argues gains grow with scale and with MoE, but the largest dense model trained is 3.2B on a 2T-token Docling mix. No 7B+ run, no long-context run, no independent reproduction yet.

Training throughput is not serving laten

No fused kernel, no vLLM or SGLang path

The reported win is tokens per day during pre-training. Inference needs an efficient kernel for the continuant recurrence; until one exists, eager-mode elementwise exp/log can quietly eat the FLOP savings.

Numerical fragility remains

Poles are baked into the function class

Log/exp removes the epsilon sweep, but the architecture is defined by poles. Extreme inputs and low-precision formats still need care, and the repo ships epsilon=0.1 as a default.

Thin evidence base

10 stars, one contributor, one open issue

The repository is a research release with a Colab notebook under Apache-2.0, not a maintained library with CI and versioned wheels. Treat the benchmarks as a hypothesis to test.

4 · Practical Playbook

Swap one FFN, leave the rest of the stack alone, and measure tokens per day per unit of quality.

Who should try it now

Teams pre-training from scratch, or running MoE blocks

Best fit: teams paying for pre-training FLOPs, and MoE builders where experts are the parameter bulk. Poor fit: anyone fine-tuning an existing checkpoint, since attention and embeddings dominate and there is no drop-in conversion path.

One-hour evaluation

Drop-in module, unchanged tensor shape

import torch
from cofrnet import CoFrNet

net = CoFrNet(in_features=768, out_features=768, width=5, depth=5)
x = torch.randn(32, 768)
y = net(x)   # (..., 768) -> (..., 768)

Four questions before adopting

Ask these before rewriting a training recipe

  • Param budget: per-FFN or whole-model savings? Dense models see about 34%, not 50%.
  • Kernel path: who writes the fused continuant kernel, and does your serving stack support it?
  • Precision: does the log/exp rewrite survive FP8 or NF4? Only NF4 on Llama was tested.
  • Baseline hygiene: was the transformer baseline tuned as hard as the CoFrNet?

Primary sources

NeurIPS 2026: Non-Expanding Gated CoFrNet for FFNs

CoFrGeNet: Continued Fraction Architectures for Language Generation

CoFrNets: Interpretable Architecture (NeurIPS 2021)

IBM/CoFrNets on GitHub (Apache-2.0)

中文导读:IBM 开源 CoFrNets:用连分数层替换 FFN,参数少三分之一而精度更高

IBM Research 开源了 CoFrNets:用连分数「梯子」替换 Transformer 的 FFN,GPT-2 XL 从 1.5B 降到 985M 参数、困惑度反而更好,Llama-MoE 直接减半。但所有结果都止步于 3.2B 参数,且均为 IBM 自建预训练。

Primary Sources & References

  1. IBM Research: IBM is open sourcing CoFrNets
  2. arXiv 2611.26835: Non-Expanding Gated Continued Fraction Architecture for FFNs
  3. arXiv 2601.21766: CoFrGeNet
  4. GitHub IBM/CoFrNets