moonshotai/attention-residuals

Attention Residuals is a drop-in replacement for standard residual connections in Transformers that enables selective aggregation of earlier layer...

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 22 minutes ago
Added to GitGenius on September 19th, 2026
Created on March 15th, 2026
Open Issues & Pull Requests: 12 (+0)
GitHub issues: Enabled
Number of forks: 205
Total Stargazers: 3,515 (+0)
Total Subscribers: 32 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 9.1 hours
Mean response time: 3.7 days
90th percentile: 6.2 days
Tracked items: 10

Most active contributors

Sign in to see contributor activity.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 12
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 167 days
Stale 30+ days: 12
Stale 90+ days: 10

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

No label distribution available yet.

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

Attention Residuals is a drop-in replacement for standard residual connections in Transformers that enables selective aggregation of earlier layer representations through learned attention over depth.

Standard residual connections accumulate all layer outputs with uniform weights, which causes hidden-state magnitudes to grow unboundedly as depth increases and dilutes each layer's contribution. Attention Residuals replaces this fixed accumulation with softmax attention computed over preceding layer outputs, where each layer uses a learned pseudo-query to selectively attend to earlier representations. The approach includes a Block variant that partitions layers into groups and applies attention only over block-level representations, reducing memory requirements from O(Ld) to O(Nd) while retaining most of the performance gains.

The tool suits projects training large Transformers where scaling efficiency matters. Block Attention Residuals serves as a practical drop-in replacement with marginal computational overhead and recovers most of the full variant's benefits. The README demonstrates improvements across scaling laws and downstream benchmarks including reasoning, code generation, and general knowledge tasks, with particularly large gains on multi-step reasoning problems.

Development activity shows consistent focus on the core technique with empirical validation across multiple model scales and downstream tasks. The repository includes detailed pseudocode and training dynamics analysis that document how the approach mitigates known issues with PreNorm architectures. The project maintains references to the underlying research paper and arXiv preprint alongside implementation details.