Transformers Haven't Hit Their Ceiling, But AGI Needs New Architectures

    Transformers remain the dominant architecture for large models and have not yet reached their performance limits. However, merely scaling up Transformers is unlikely to directly lead to Artificial General Intelligence (AGI). This article explores the reasons from four perspectives—computational costs, hybrid architectures, cognitive limitations, and engineering trade-offs—and provides practical evaluation methods.

    Transformers have not yet reached their performance ceiling and remain the primary architecture for current large models. However, relying solely on scaling up Transformers is unlikely to directly lead to Artificial General Intelligence (AGI). Below, we explore the reasons from four perspectives: computational costs, hybrid architectures, cognitive limitations, and engineering trade-offs, while offering practical evaluation methods.

    1. The Costs and Bottlenecks of Pure Transformers

    1.1 Quadratic Computational Cost

    Standard self-attention calculates the correlation between every pair of positions in a sequence, meaning the computational complexity scales quadratically with the context length N. When N doubles, the computational load of the attention mechanism increases roughly fourfold; when N increases tenfold, it grows by about a hundredfold. If the full attention matrix is written to VRAM, its memory footprint also grows quadratically with N.

    Operators like FlashAttention accelerate computation through block processing and reducing VRAM read/write operations. They primarily optimize constant factors and memory access overhead, but they do not change the O(N^2) asymptotic complexity. Therefore, ultra-long contexts with millions of tokens still require additional system designs, such as windowed attention, KV cache compression, or sparse attention.

    The figures above are asymptotic estimates. Actual latency also depends on sequence length, batch size, numerical precision (FP16, BF16, etc.), and hardware bandwidth. When measuring performance, these conditions should be kept constant to fairly compare different approaches.

    1.2 Information Dilution in Long Contexts

    Even when context windows are extended using methods like RoPE, many experiments still observe the “lost in the middle” phenomenon: the model’s ability to extract key information located in the middle of a long text degrades. Attention weights are dispersed across a massive number of tokens, diluting critical signals. The severity of this phenomenon depends on the model, task, and evaluation dataset, and there is no unified conclusion in the industry yet. During model selection, it is recommended to conduct “needle in a haystack” tests using your own task data rather than relying on general leaderboards.

    2. Hybrid Architectures: Transformer Plus SSM

    2.1 The Classification Debate

    State Space Models (SSMs) process sequences through linear recursion, offering an O(N) computational complexity that is well-suited for ultra-long contexts. Many recent models adopt an interleaved structure combining Transformers and SSMs. There are two perspectives on how to categorize this. One view suggests it marks a paradigm shift towards SSMs, while the other argues a more accurate description is a “Transformer with SSM components.” The rationale for the latter is that self-attention still holds an advantage in capturing global nonlinear dependencies and semantic alignment, whereas SSMs act more like linear state compressors to compensate for shortcomings in long sequences. The disagreement is primarily over naming conventions and does not alter the underlying engineering trade-offs.

    2.2 Engineering Implementation Example

    The following code is a minimal educational example illustrating the data flow of a hybrid layer. Each sublayer uses an independent LayerNorm (pre-norm structure), and the SSM employs a simplified diagonal linear recursion implementation.

    1. import torch
    2. import torch.nn as nn
    3. import torch.nn.functional as F
    4. class SelfAttention(nn.Module):
    5. def __init__(self, d_model, n_heads):
    6. super().__init__()
    7. self.n_heads = n_heads
    8. self.head_dim = d_model // n_heads
    9. self.qkv = nn.Linear(d_model, 3 * d_model)
    10. self.out = nn.Linear(d_model, d_model)
    11. def forward(self, x): # x: [B, N, D]
    12. B, N, D = x.shape
    13. q, k, v = self.qkv(x).chunk(3, dim=-1)
    14. q, k, v = [t.reshape(B, N, self.n_heads, self.head_dim).transpose(1, 2)
    15. for t in (q, k, v)] # [B, H, N, Hd]
    16. y = F.scaled_dot_product_attention(q, k, v, is_causal=True)
    17. y = y.transpose(1, 2).reshape(B, N, D) # [B, N, D]
    18. return self.out(y)
    19. class StateSpaceModel(nn.Module):
    20. """h_t = A * h_{t-1} + B x_t, y_t = C h_t, where A is diagonal and 0 < A < 1"""
    21. def __init__(self, d_model, d_state):
    22. super().__init__()
    23. self.a_logit = nn.Parameter(torch.zeros(d_state)) # A = sigmoid(a_logit)
    24. self.B = nn.Linear(d_model, d_state, bias=False)
    25. self.C = nn.Linear(d_state, d_model, bias=False)
    26. def forward(self, x, h0=None): # x: [B, N, D]
    27. Bsz, N, _ = x.shape
    28. A = torch.sigmoid(self.a_logit) # [S]
    29. h = h0 if h0 is not None else x.new_zeros(Bsz, A.shape[0]) # [B, S]
    30. u = self.B(x) # [B, N, S]
    31. ys = []
    32. for t in range(N):
    33. h = A * h + u[:, t] # [B, S]
    34. ys.append(h)
    35. y = self.C(torch.stack(ys, dim=1)) # [B, N, D]
    36. return y, h
    37. class HybridBlock(nn.Module):
    38. def __init__(self, d_model, n_heads, d_state):
    39. super().__init__()
    40. self.norm1 = nn.LayerNorm(d_model)
    41. self.norm2 = nn.LayerNorm(d_model)
    42. self.attn = SelfAttention(d_model, n_heads)
    43. self.ssm = StateSpaceModel(d_model, d_state)
    44. def forward(self, x, h0=None):
    45. x = x + self.attn(self.norm1(x)) # Global attention sublayer with residual
    46. y, h = self.ssm(self.norm2(x), h0) # Linear state sublayer with residual
    47. x = x + y
    48. return x, h
    49. # Minimal check
    50. x = torch.randn(2, 128, 256)
    51. block = HybridBlock(d_model=256, n_heads=8, d_state=64)
    52. out, h = block(x)
    53. assert out.shape == (2, 128, 256)
    54. assert h.shape == (2, 64)

    After running the code, you can verify the following:

    • The input and output shapes are both [B, N, D], maintaining consistent dimensions across layers.
    • The hidden state shape is [B, S]. For cross-segment inference, this state must be saved and passed to the next segment.
    • The Python loop above will be very slow for large N. Production implementations typically use parallel scan or convolutional forms to compute the SSM.
    • When estimating VRAM usage, distinguish between two parts. The KV cache in the attention layer grows linearly with N, while the state size of the SSM layer depends only on S, independent of N.

    3. Can Transformers Alone Achieve AGI?

    AGI is generally expected to possess cross-domain generalization, causal reasoning, and continuous learning capabilities. Architectural optimizations can improve efficiency, but they may not solve the following issues. The views below are part of ongoing research discussions and are not yet definitive.

    3.1 Fast and Slow Thinking

    Some researchers compare current Transformers to “System 1” thinking—fast and intuitive pattern recognition, but potentially lacking the deliberate, analytical reasoning mechanisms of “System 2” required for complex problem-solving.