CWAA Architecture Explained: Replacing Transformer Attention with Complex Wave Dynamics

CWAA replaces Transformer attention with damped complex oscillators, achieving linear memory scaling and ~7% better perplexity at 10M params.
CWAA (Complex Wave Associative Memory) is an independent research project that replaces Transformer self-attention with damped complex oscillators for sequence modeling. At 10M parameters on WikiText-103, it achieves ~7% better perplexity than a vanilla Transformer (139.09 vs 149.19) with O(T) linear memory scaling. The V6 version decomposes complex math into real BMM for better GPU utilization. While promising, the work remains early-stage with limited scale and incomplete controlled comparisons.
An Unconventional Approach to Sequence Modeling
Years after the Transformer architecture came to dominate NLP, independent researchers continue attempting to fundamentally rethink the mechanism of sequence mixing. Recently, an independent researcher shared his open-source project CWAA (Complex Wave Associative Memory) on Reddit, proposing to replace standard attention mechanisms with complex wave dynamics.
Unlike mainstream Transformers that rely on quadratic-complexity self-attention, CWAA's core idea uses damped complex oscillators to maintain recurrent state, achieving O(T) linear memory scaling. This design directly addresses the core pain point of Transformers on long sequences—the computational and memory overhead of attention matrices growing quadratically with sequence length. The quadratic complexity refers to standard self-attention needing to compute association scores between every pair of tokens. For a sequence of length T, this means O(T²) dot product operations and a T×T attention matrix. When sequence lengths reach tens or hundreds of thousands of tokens, memory and computational costs become prohibitively expensive.

CWAA Core Mechanism: From Attention to Damped Oscillation
Complex Oscillators as Memory Carriers
The most striking aspect of CWAA is that it encodes sequence information into a complex wave state. Traditional attention establishes token-to-token associations through pairwise Query-Key-Value interactions, while CWAA lets information at each timestep propagate, superpose, and decay in wave form within the network.
From a mathematical perspective, the core of the complex oscillator is Euler's formula e^{iθ} = cos(θ) + i·sin(θ)—a complex multiplication essentially corresponds to a rotation and scaling. When hidden states exist in complex form, the state update at each timestep can be expressed as h_t = λ·h_{t-1} + x_t, where λ is a complex coefficient—its modulus |λ|<1 produces decay (damping), and its argument determines the oscillation frequency. This means information at different frequencies can decay at different rates within the same state vector, naturally achieving multi-timescale memory encoding.
The introduction of damping is crucial—it determines how quickly historical information decays over time, essentially similar to the gating/decay mechanisms in linear RNNs and State Space Models (SSMs, such as Mamba). State Space Models originate from control theory, with the core form h'(t) = Ah(t) + Bx(t), y(t) = Ch(t), obtaining a recurrent form through discretization of continuous-time ODEs. Mamba, released in late 2023, demonstrated performance comparable to Transformers on language modeling for the first time through input-dependent selective mechanisms (Selective State Space), while maintaining linear time complexity. RWKV represents another path, achieving similar effects through its "linear attention + time decay" WKV operator. These linear recurrence architectures have been one of academia's primary directions for combating Transformer quadratic complexity in recent years, and CWAA can be viewed as an exploration within this trend, bringing a unique "wave" perspective.
From Complex Tensors to Pure Real Matrix Multiplication
The author revealed an important engineering evolution: the existing V5 version in the repository directly uses native complex64 tensors, while the newly completed V6 version decomposes complex operations into pure real batched matrix multiplications (BMM).
The significance of this change should not be underestimated. Native complex arithmetic is poorly supported on mainstream deep learning frameworks and GPUs, often failing to fully utilize hardware matrix multiplication units (such as Tensor Cores). NVIDIA's Tensor Cores are hardware units specifically designed for matrix multiply-accumulate operations—from the first generation on V100 to the fourth generation on H100, their design has consistently been optimized around real-number (FP16/BF16/FP8) matrix multiplication. When using complex64, frameworks typically need to split it into multiple real-number operations and recombine, but this automatic splitting often cannot match manually optimized efficiency and may introduce additional memory copies and synchronization overhead. Rewriting the complex math as real BMM means the model can better interface with existing hardware acceleration ecosystems, with training stability and efficiency improving accordingly—the author reports V6 achieves 0.38 seconds/step training speed on a single T4 GPU and is "highly stable." The T4 is an inference-optimized GPU released by NVIDIA in 2018, featuring 65 TFLOPS of FP16 compute and 16GB of memory. Widely deployed in cloud computing, its cost-effectiveness makes it the hardware of choice for many independent researchers.
CWAA Experimental Results: Comparison at 10M Parameters
The author compared CWAA against a standard Transformer on the WikiText-103 dataset with roughly equivalent parameter counts:
| Metric | CWAA V6 | Vanilla Transformer |
|---|---|---|
| Parameters | 10.402M | 10.373M |
| Training Steps | 5,000 | 5,000 |
| Validation Loss | 4.9351 | 5.0052 |
| Validation Perplexity (PPL) | 139.09 | 149.19 |
The data shows CWAA slightly outperforming the standard Transformer of equivalent size on both validation loss and perplexity—139.09 vs. 149.19 in perplexity, approximately a 7% relative improvement. WikiText-103 is an English Wikipedia corpus containing approximately 100 million tokens, long serving as a standard dataset for language model benchmarking. Its characteristic of containing longer article-level contexts makes it suitable for evaluating a model's long-range dependency modeling capability.
Sequence Length Scalability
The author also provided CWAA's inference performance at different sequence lengths:
| Sequence Length | Latency (ms) | Throughput (Tok/s) | Memory (GB) |
|---|---|---|---|
| 256 | 34.62 | 29575.1 | 1.51 |
| 512 | 128.11 | 15986.8 | 1.89 |
| 1024 | 253.16 | 16179.3 | 2.66 |
| 2048 | 510.13 | 16058.6 | 4.20 |
| 4096 | 1044.72 | 15682.6 | 7.27 |
Interestingly, as sequence length doubles from 256 to 4096, memory usage grows from 1.51GB to 7.27GB, exhibiting a near-linear growth trend consistent with its O(T) design goal. By comparison, a standard Transformer's attention matrix at sequence length 4096 requires storing a 4096×4096 matrix (per layer per head), with memory usage growing quadratically with length—precisely the problem that engineering optimizations like Flash Attention and various linear attention variants attempt to solve.
Limitations That Warrant Careful Consideration
Despite the encouraging-looking data, this work remains at a very early stage, and several key issues deserve emphasis:
Comparison Conditions Not Fully Aligned
The author himself acknowledges that the initial Transformer baseline used different experimental conditions, meaning the scalability data in the table above is currently CWAA-only measurements, lacking a Transformer control under identical conditions. The author states he will re-run fully apples-to-apples inference and memory comparisons within two days. This means the "beats vanilla Transformer" conclusion still requires more rigorous verification.
Limitations of a 5,000-Step Short Experiment
With only 5,000 training steps and 10M parameters, we can only conclude that CWAA is competitive at small model scale with short training, but cannot prove its performance at large scale with extended training. Historically, many alternative architectures have outperformed Transformers in small-scale tests but struggled to maintain their advantage under Scaling Laws.
Scaling Laws are empirical regularities systematically proposed by Kaplan et al. at OpenAI in 2020: language model performance (measured by cross-entropy loss) exhibits power-law relationships with model parameters, training data volume, and compute—and these relationships remain stable across multiple orders of magnitude. Transformers became the dominant architecture largely because they consistently follow these scaling laws from millions to trillions of parameters, with performance improving predictably. Many alternative architectures (such as early linear attention variants) performed well at 10M-100M parameters but exhibited training instability or performance saturation when scaling to billions of parameters, unable to maintain the same scaling slope as Transformers. The real test is whether an architecture can scale stably as parameters and data grow.
Sonification Visualization Experiment
Interestingly, the author also recorded an audio clip "sonifying" the evolution of internal wave states across V5's layers—directly generating sound from the model's internal wave dynamics. While this approach leans more toward artistic expression than rigorous evaluation, it reflects how the "wave" physical metaphor permeates the architecture design. Sonification, as an auditory counterpart to data visualization, has a long history in scientific computing—from audio conversion of the cosmic microwave background radiation to the sound presentation of gravitational waves. Mapping non-auditory data to human-perceivable frequency ranges can sometimes reveal patterns and periodicities that visual charts struggle to capture.
Conclusion: The Value of Independent Research and Open-Source Community
CWAA is a typical independent researcher's work—novel ideas, open-source code, preliminary data, but accompanied by the reality of insufficiently rigorous experiments and validation that needs supplementing. In an era where SSMs, linear attention, RWKV, and various other Transformer alternatives continue to emerge, approaching sequence modeling through complex wave dynamics at least offers an intriguing new perspective worth contemplating.
For developers following cutting-edge architectures, cautious optimism is warranted: wait for the author to release complete controlled experiments and V6 code before judging its true competitiveness. The project is open-sourced on GitHub (Ridhvik-2024/CWAA-V5), and community participation in verification and feedback is welcome—this is exactly how open-source research should work.
Key Takeaways
Related articles

EmbeddedSass for .NET: A Sass Compilation Solution Without Node.js Dependencies
EmbeddedSass for .NET uses the official Embedded Sass Protocol, enabling .NET developers to compile Sass/SCSS natively without Node.js. Learn how it works and integrates with ASP.NET.

San Francisco to Singapore Time Difference: The Trans-Pacific Routine of Silicon Valley Tech Workers
SF and Singapore are 15-16 hours apart, and frequent travel between them is now routine for tech workers. Explore the time difference challenges, AI industry globalization, and talent flows.

Anthropic Launches Official Claude Code Plugin Directory: A Curated High-Quality Extension Ecosystem
Anthropic launches claude-plugins-official, a curated directory of high-quality Claude Code plugins. Learn about its positioning, core value, and impact on the AI coding ecosystem.