This repository contains the official implementation of "CATS: Contextually-Aware Thresholding for Sparsity in Large Language Models" by Je-Yong Lee, Donghyun Lee, Genghan Zhang, Mo Tiwari, and Azalia Mirhoseini, as described in our paper on arXiv.
Overview
Our paper, "CATS: Contextually-Aware Thresholding for Sparsity in Large Language Models," introduces CATS—a new method aimed at reducing the computational demands of deploying LLMs without sacrificing their performance on downstream tasks. This method centers around a novel activation function that enhances activation sparsity effectively and efficiently.
The CATS approach can be applied to various base models such as Mistral-7B and Llama2-7B, demonstrating a minimal performance drop (within 1-2% of the base models) even at 50% activation sparsity levels. Importantly, CATS not only accelerates convergence but also integrates a custom GPU kernel that enhances inference speeds by approximately 15%.
Reproducing Results
To reproduce the experimental results and figures presented in our work, please follow the steps outlined below. The process has been simplified into a single script to ensure ease of use and to maintain consistency across different environments.
Prerequisites
Ensure you have the following prerequisites installed:
- Bash shell (Unix/Linux/Mac)
- Required Python packages (listed in
requirements.txt) - Set an
accelerateconfiguration file based on your environment by runningaccelerate config
Steps
- Open a terminal in the root directory of the project.
- Run the following command:
bash reproduction_script.sh [path1] [path2]
- [path1]: Directory where the checkpoints for fine-tuned models will be stored.
- [path2]: Directory where the results of the experiments, such as figures and histograms, will be saved.
Work in progress
We are currently developing a framework that will enable CATS to be easily integrated with any model from the HuggingFace library.
Metadata
Release files for simple-cats 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| simple_cats-0.1.3.tar.gz | 16.8 kB | Without provenance | Details for simple_cats-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| simple_cats-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for simple_cats-0.1.3-py3-none-any.whl |
Total release size: 41.1 kB
Release files / simple_cats-0.1.3.tar.gz
| Download URL | simple_cats-0.1.3.tar.gz |
|---|---|
| Size | 16.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d46573d0709cbc118d84f603ecda2e39ed321c324a1d08e53b6fdf26d05025dc
|
|
BLAKE2b-256 checksum How to use checksums |
e97187580d6c18b1e85483357e20ca22d1b4d85fe9b1539f114bf442914e7ace
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.14
|
Release files / simple_cats-0.1.3-py3-none-any.whl
| Download URL | simple_cats-0.1.3-py3-none-any.whl |
|---|---|
| Size | 24.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
349b44b758f6869e89d2992a7148c316206cd546df1777ace7c64f5682d54a32
|
|
BLAKE2b-256 checksum How to use checksums |
1ec630fb5759cd596cb17a0c20134387ffa6bf45cb97d0c82e27b0ec2fa9d395
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.14
|
Security for simple-cats 0.1.3
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.