A collection of tricks to speed up LLMs, see our transformer-tricks papers on arXiv
Project description
Transformer Tricks
A collection of tricks to simplify and speed up transformer models:
- Slim attention: [paper], [video], [podcast], [notebook], [code-readme], [reddit]
- Matrix-shrink [work in progress]: [paper]
- Flash normalization: [paper], [podcast], [notebook], [code-readme]
- Precomputing the first layer: [paper], [podcast]
- Removing weights from skipless transformers: [paper], [podcast], [notebook]
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:
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.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34cd45757eafd9e164fcb8aa65a0e5a1421732e7afcd4fdbf84969ae3aabb4ae
|
|
| MD5 |
cd9696da1b1c0de02d1773715298c674
|
|
| BLAKE2b-256 |
ba4f1f7a13861bcab02bae99bac2cb1c6fcd019732803b8309154c620a19377d
|
File details
Details for the file transformer_tricks-0.3.4-py3-none-any.whl.
File metadata
- Download URL: transformer_tricks-0.3.4-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a2390e5bf323d105743fe68ec5764421906bc33a39239e41e7263169a32ac2a
|
|
| MD5 |
ecf67a05c6997546a1f294bd24265e03
|
|
| BLAKE2b-256 |
2ab17f8a7e1030dfc0893e41e8eb47cfbc07f03e6bef08ff4119636216686877
|