ATMA: Length-Invariant Language Modeling via Polar Attention and Gated-Delta Compression Memory

Habibullah Akbar
6/23/2026
cs.LGcs.AI

Official code: kreasof-ai/atma (1 star, PyTorch, last commit 2026-06-23).

Abstract

Modern large language models based on softmax scaled-dot-product attention are constrained by their training sequence length: as the key-value sequence grows, softmax probability mass can dilute across a wider distribution, inducing activation shift and long-context performance collapse. Moreover, long-context language modeling faces a structural tension: a sliding-window attention core maintains a bounded local representation and low perplexity but is blind to long-range dependencies, while full-context attention preserves global recall but suffers from out-of-distribution perplexity explosion. To resolve these limitations, we introduce ATMA, a hybrid convolutional-attention architecture that integrates a novel three-channel attention mechanism. ATMA factorizes the attention mixing step into: (1) a count-blind, unit-vector direction channel, (2) a bounded magnitude channel driven by the participation ratio of effective matches over an extreme-value-corrected null sink, and (3) a long-term recurrent compression memory optimized via a gated-delta fast-weights rule. Neither the Polar Attention core nor the recurrent memory is sufficient alone; their combination enables monotonic perplexity reduction and high-fidelity long-range retrieval simultaneously. We evaluate ATMA using a 100-run factorial ablation sweep, demonstrating that the combined Polar + memory model maintains induction needle-in-a-haystack retrieval accuracy above 90% out to 64K tokens (32 times the training length of 2K) while its document perplexity improves monotonically, outperforming softmax-based memory baselines which collapse at extreme context lengths. Code: https://github.com/kreasof-ai/atma

View on arXivView PDF

Code Implementations(1)

kreasof-ai/atmaOfficial100%
PyTorch

Atma - LLM training & inference stack in one codebase

10TeX, HTMLMay 20, 20263 months ago
inferencellmpytorchtrainingtransformers

Similar Papers

Cite this paper

@article{akbar2026atma,
  title  = {ATMA: Length-Invariant Language Modeling via Polar Attention and Gated-Delta Compression Memory},
  author = {Habibullah Akbar},
  year   = {2026},
  eprint = {2606.25156},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2606.25156v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2606.25156.svg)](https://codeofpaper.com/paper/2606.25156)

Discussion