Skip to main content

ScalableSoftmax

An unofficial PyTorch implementation of Scalable-Softmax (Ssmax) from the paper "Scalable-Softmax Is Superior for Attention" (Nakanishi, 2025).

Overview

ScalableSoftmax is a drop-in replacement for standard Softmax that helps prevent attention fading in transformers by incorporating input size scaling. This helps maintain focused attention distributions even with large input sizes.

Installation

pip install scalable-softmax

Usage

import torch
from scalable_softmax import ScalableSoftmax

# Initialize with default parameters
ssmax = ScalableSoftmax()

# Or customize parameters
ssmax = ScalableSoftmax(
    s=0.43,  # scaling parameter
    learn_scaling=True,  # make scaling parameter learnable
    bias=False  # whether to use bias term
)

# Apply to input tensor
x = torch.randn(batch_size, sequence_length)
output = ssmax(x)

Features

  • Drop-in replacement for standard softmax
  • Learnable scaling parameter
  • Optional bias term
  • Maintains focused attention with large inputs

Citation

@article{nakanishi2025scalable,
  title={Scalable-Softmax Is Superior for Attention},
  author={Nakanishi, Ken M.},
  journal={arXiv preprint arXiv:2501.19399},
  year={2025}
}

License

MIT License

Metadata

Release files for scalable-softmax 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scalable-softmax 0.1.5
File Size Uploaded Provenance
scalable_softmax-0.1.5.tar.gz 3.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for scalable-softmax 0.1.5
File Interpreter ABI Platform
scalable_softmax-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 8.8 kB

Release files / scalable_softmax-0.1.5.tar.gz

Download URL scalable_softmax-0.1.5.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
efda67c36891b8224103593aa9afca490d9e7cd8d215ee79360b7986363a70e3
BLAKE2b-256 checksum
How to use checksums
00a93fe9f5b877f631c6362cfb21a2d9b2681caacf6b4bdd931a5058b7539ddb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.22

Release files / scalable_softmax-0.1.5-py3-none-any.whl

Download URL scalable_softmax-0.1.5-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0fd4a87e1e8b2b28e7089fdab41e1367322b483d446678b730045fb7c008e2e6
BLAKE2b-256 checksum
How to use checksums
0a540b4c3f0dc543b9a8e7e232a419d066bd1ceddd88456b35ce21358830fda2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.22

Security for scalable-softmax 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page