Skip to main content

A collection of tricks to speed up LLMs, see our transformer-tricks papers on arXiv

Project description

Transformer Tricks

PyPI PyPI Downloads

A collection of tricks to simplify and speed up transformer models:

Many of these tricks follow a recent trend of removing parts from neural networks such as RMSNorm’s removal of mean centering from LayerNorm, PaLM's removal of bias-parameters, decoder-only transformer's removal of the encoder stack, and of course transformer’s revolutionary removal of recurrent layers.

For example, our FlashNorm removes the weights from RMSNorm and merges them with the next linear layer. And slim attention removes the entire V-cache from the context memory for MHA transformers.


Installation

Install the transformer tricks package:

pip install transformer-tricks

Alternatively, to run from latest repo:

git clone https://github.com/OpenMachine-ai/transformer-tricks.git
pip3 install --quiet -r requirements.txt

Documentation

Follow the links below for documentation of the python code in this directory:


Notebooks

The papers are accompanied by the following Jupyter notebooks:

  • Slim attention: Colab
  • Flash normalization: Colab Colab
  • Removing weights from skipless transformers: Colab

Newsletter

Please subscribe to our newsletter on substack to get the latest news about this project. We will never send you more than one email per month.

Substack


Contributing

We pay cash for high-impact contributions. Please check out CONTRIBUTING for how to get involved.


Sponsors

The Transformer Tricks project is currently sponsored by OpenMachine. We'd love to hear from you if you'd like to join us in supporting this project.


Please give us a ⭐ if you like this repo, and check out TinyFive


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

transformer_tricks-0.3.4.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

transformer_tricks-0.3.4-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file transformer_tricks-0.3.4.tar.gz.

File metadata

  • Download URL: transformer_tricks-0.3.4.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.9

File hashes

Hashes for transformer_tricks-0.3.4.tar.gz
Algorithm Hash digest
SHA256 34cd45757eafd9e164fcb8aa65a0e5a1421732e7afcd4fdbf84969ae3aabb4ae
MD5 cd9696da1b1c0de02d1773715298c674
BLAKE2b-256 ba4f1f7a13861bcab02bae99bac2cb1c6fcd019732803b8309154c620a19377d

See more details on using hashes here.

File details

Details for the file transformer_tricks-0.3.4-py3-none-any.whl.

File metadata

File hashes

Hashes for transformer_tricks-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2a2390e5bf323d105743fe68ec5764421906bc33a39239e41e7263169a32ac2a
MD5 ecf67a05c6997546a1f294bd24265e03
BLAKE2b-256 2ab17f8a7e1030dfc0893e41e8eb47cfbc07f03e6bef08ff4119636216686877

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page