
retnet_yet_another
Language86 ops27.5K params
7 models, language. Fewest parameters first.
RetNet, the Retentive Network, is proposed as a foundation architecture for large language models that aims to get training parallelism, low-cost inference and good performance at the same time. Its core is the retention mechanism, which the authors derive from a connection between recurrence and attention and which supports three computation paradigms: parallel, recurrent and chunkwise recurrent. The parallel form gives training parallelism, the recurrent form gives O(1) per-token inference, and the chunkwise form encodes each chunk in parallel while recurrently summarising the chunks for linear-complexity long sequences.
A third-party implementation describes the payoff as the 'impossible triangle' of language-model design: accuracy comparable to Transformers, high training throughput from the parallel form and high inference throughput from the recurrent form. The three forms are numerically equivalent, and that repository's tests check the parallel, recurrent and chunkwise outputs against each other, noting only small floating-point drift in the recurrent path. Since October 2023 the official torchscale implementation uses RMSNorm and SwiGLU as RetNet's default modules.
The official implementation lives in Microsoft's torchscale library, where a RetNet model is created from a RetNetConfig in several lines of code. The yet-another-retnet port also ships preconfigured, untrained 1.3B, 2.7B and 6.7B models matching the paper's configurations.
AI-written summary; not reviewed by a person. Corrections welcome.
Paper: Retentive Network: A Successor to Transformer for Large Language Models

Language86 ops27.5K params

Language180 ops97.2K params

Language322 ops97.2K params

Language324 ops97.2K params

Language197 ops123.2K params

Language80 ops3.2M params

Language518 ops84.6M params