Skip to main content

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 accelerate configuration file based on your environment by running accelerate config

Steps

  1. Open a terminal in the root directory of the project.
  2. 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

simple-cats-0.1.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

simple_cats-0.1.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file simple-cats-0.1.1.tar.gz.

File metadata

  • Download URL: simple-cats-0.1.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for simple-cats-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8b87265658e3be22601d3b663e78abcb1867095ae4ba43e69272252f2763262e
MD5 b1a7ecf24da7b2e7ea39fa5994442a4b
BLAKE2b-256 fe511552ae75f123c7a6f4abb9f617b50908648c9a770dc5ee8b451f13689097

See more details on using hashes here.

File details

Details for the file simple_cats-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: simple_cats-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for simple_cats-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5b8f0aa2fe9684d5db8cb7e377c1e647d370f11359a57248b2618743d3ca6d27
MD5 94756b16ac188fc83f14290fb8fae02a
BLAKE2b-256 d9874105721ac5735c538b42cbe4ac924479a2e6580bfba49595fb655aa989a1

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