Python package for CATS paper
Project description
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.
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
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 simple_cats-0.1.2.tar.gz.
File metadata
- Download URL: simple_cats-0.1.2.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85fd0ddc26453a2a1c43b0035dce5690ab98e01f761007bc03f2578a420af320
|
|
| MD5 |
c95bb53b265a636d3259c2ab21c80ffa
|
|
| BLAKE2b-256 |
920562230b58594fb3fced3111e671462d041c386f97582d80243190cae009fa
|
File details
Details for the file simple_cats-0.1.2-py3-none-any.whl.
File metadata
- Download URL: simple_cats-0.1.2-py3-none-any.whl
- Upload date:
- Size: 24.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05c32b7ec3270b9375c9a7ab7f56e81088028531145429677ca98f18a7e7f5a0
|
|
| MD5 |
86db460ba77829e23ec7f1a7e6c1535b
|
|
| BLAKE2b-256 |
620f5d7db2603f9b78f1d66620cdbe3a89ac4464d1163fd0944734f3ea87bfaa
|