skillfed

hyper-connections

Hyper-Connections

hyper-connections v0.4.11 321.8K downloads/30d#7,619 on PyPI188
Permissive license MIT License Copyright (c) 2024 Phil Wang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in… (full text in the JSON record) Active released

What it is and what it does

Hyper-Connections is a PyTorch library that implements the multiple residual streams architecture from the Hyper-Connections paper (arXiv:2409.19606). It provides utilities to split a single residual pathway into multiple independent streams, apply branch operations to each stream separately, and then recombine them—a technique proposed to improve deep network training. The library wraps around standard PyTorch layers and offers both a high-level API (expand_stream, reduce_stream, init_hyper_conn) and lower-level control for manual stream management.

The package depends on torch, einops, and torch-einops-utils for tensor manipulation. It supports disabling the multi-stream behavior for ablation studies and includes experimental support for fractionated feature dimensions from follow-up research. The library is actively maintained, has no known security vulnerabilities, and is designed to integrate into existing model architectures with minimal code changes.

Use it for:

  • Experimenting with multi-stream residual architectures in transformer or CNN models to improve training stability.
  • Comparing standard residual connections against hyper-connections by toggling disable=True without refactoring code.
  • Implementing fractionated feature dimension splits across residual pathways as proposed in follow-up papers.
  • Prototyping deep networks (1000+ layers) where multiple residual streams may reduce gradient flow issues.
  • Researching variants of residual connections for improved convergence in large-scale deep learning models.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Implements multiple residual streams in neural networks as proposed in the Hyper-Connections paper, allowing you to split, process, and recombine residual pathways within PyTorch models.

Yes, if you are actively researching or experimenting with advanced residual connection architectures in PyTorch. The library is low-friction to install, has no security issues, and offers a clean API for integrating multi-stream residuals into existing models. Not necessary for standard production models using conventional residual connections.

Install

hyper-connections on PyPI

pip

pip install hyper-connections

uv

uv add hyper-connections

poetry

poetry add hyper-connections

Installing hyper-connections

Before you install

Low install friction with a pure Python wheel and only three runtime dependencies (torch, einops, torch-einops-utils). Repository is active with recent commits and no known vulnerabilities.

License in practice

MIT License permits unrestricted use, modification, and distribution in commercial and private projects with minimal obligations—only attribution and license inclusion required.

Quickstart

pip install hyper-connections

import torch
from hyper_connections import get_init_and_expand_reduce_stream_functions

init_hyper_conn, expand_stream, reduce_stream = get_init_and_expand_reduce_stream_functions(4)
residual = torch.randn(2, 1024, 512)
residual = expand_stream(residual)
residual = reduce_stream(residual)

Requires PyTorch and Python 3.9 or later; intended for use within existing neural network training pipelines.

Verify before relying

  • Whether the library supports automatic differentiation through all stream operations without gradient issues.
  • Performance overhead of expand/reduce operations compared to standard residual connections at scale.
  • Compatibility with specific PyTorch versions or distributed training frameworks.

Package facts

License MIT License Copyright (c) 2024 Phil Wang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 3 — einops, torch-einops-utils, torch
Maintenance actively maintained — 93 days since the last release
Last repo commit
First released
Downloads 321,759/month — #7,619 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: hyper_connections-0.4.11-py3-none-any.whl

Keywords: artificial intelligence, deep learning, residual

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3.9Topic :: Scientific/Engineering :: Artificial Intelligence

Tags

multiple residual streams pytorchhyper connections neural networksresidual pathway splittingdeep learning residual architecturetorch residual connectionsbranching residual streamsneural network residual design
residual-networkstransformer-researchpytorch-extension

More Artificial Intelligence packages