Downloads · 30 days
11
19% of all-time downloads
Syed-Hasan-8503/PaluLlama-3-8B-Instruct
PaluLlama-3-8B-Instruct is a text generation model from Syed-Hasan-8503. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This repository contains a compressed version of the Meta Llama-3-8B-Instruct model, utilizing the Palu framework for KV-Cache compression. Palu reduces the hidden dimensions of the KV-Cache through low-rank decomposi…
Downloads · 30 days
11
19% of all-time downloads
All-time downloads
59
Public
Parameters
8B
15.9 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors15.9 GB · 100%
From the Hugging Face model README
This repository contains a compressed version of the Meta Llama-3-8B-Instruct model, utilizing the Palu framework for KV-Cache compression. Palu reduces the hidden dimensions of the KV-Cache through low-rank decomposition, significantly reducing the model's memory footprint while maintaining or enhancing performance.
| Model | PPL |
|---|---|
| meta-llama-3-8b-instruct-palu | 8.8309 |
| meta-llama-3-8b-instruct (Base) | 8.2845 |
| Tasks | Version | Filter | n-shot | Metric | Value | Stderr |
|---|---|---|---|---|---|---|
| winogrande | 1 | none | 0 | acc | 0.7277 | ±0.0125 |
| arc_challenge | 1 | none | 0 | acc | 0.4949 | ±0.0146 |
| 0 | acc_norm | 0.5427 | ±0.0146 | |||
| arc_easy | 1 | none | 0 | acc | 0.7942 | ±0.0083 |
| 0 | acc_norm | 0.7551 | ±0.0088 | |||
| piqa | 1 | none | 0 | acc | 0.7655 | ±0.0099 |
| 0 | acc_norm | 0.7644 | ±0.0099 | |||
| hellaswag | 1 | none | 0 | acc | 0.5664 | ±0.0049 |
| 0 | acc_norm | 0.7511 | ±0.0043 | |||
| openbookqa | 1 | none | 0 | acc | 0.3360 | ±0.0211 |
| 0 | acc_norm | 0.4380 | ±0.0222 |
| Tasks | Version | Filter | n-shot | Metric | Value | Stderr |
|---|---|---|---|---|---|---|
| winogrande | 1 | none | 0 | acc | 0.7206 | ±0.0126 |
| arc_challenge | 1 | none | 0 | acc | 0.5299 | ±0.0146 |
| 0 | acc_norm | 0.5683 | ±0.0145 | |||
| arc_easy | 1 | none | 0 | acc | 0.8161 | ±0.0079 |
| 0 | acc_norm | 0.7976 | ±0.0082 | |||
| piqa | 1 | none | 0 | acc | 0.7867 | ±0.0096 |
| 0 | acc_norm | 0.7856 | ±0.0096 | |||
| hellaswag | 1 | none | 0 | acc | 0.5769 | ±0.0049 |
| 0 | acc_norm | 0.7581 | ±0.0043 | |||
| openbookqa | 1 | none | 0 | acc | 0.3420 | ±0.0212 |
| 0 | acc_norm | 0.4320 | ±0.0222 |
| Model | Score |
|---|---|
| meta-llama-3-8b-instruct-palu | 89.45 |
| meta-llama-3-8b-instruct (Base) | 90.56 |
| Model | Score |
|---|---|
| meta-llama-3-8b-instruct-palu | 34.92 |
| meta-llama-3-8b-instruct (Base) | 31.74 |
Ensure you have Git and Conda installed on your system.
git clone --recurse-submodules https://github.com/shadowpa0327/Palu.git
cd Palu
Create and activate a Conda environment.
conda create -n Palu python=3.10
conda activate Palu
pip install -r requirements.txt
pip install -e 3rdparty/lm-evaluation-harness
pip install -e 3rdparty/fast-hadamard-transform
To compress Meta Llama-3-8B-Instruct using Palu's low-rank decomposition, use the following command:
python compress.py \
--model_id="meta-llama/Llama-3-8b-instruct" \
--calib_dataset wikitext2 \
--param_ratio_target 0.7 \
--search_method fisher_uniform \
--head_group_size 4 \
--dump_huggingface_model \
--use_cache
The compressed model will be saved in the Meta-Llama-3-8b-instruct_ratio-0.7_gs-4-fisher_uniform directory in Hugging Face format.
To evaluate the perplexity on the wikitext2 dataset with sequence length 2048, run:
python run_ppl_eval.py \
--model_name_or_path /Path/To/Palu/Model \
--datasets wikitext2 \
--seqlen 2048
To evaluate with 3-bit low-rank aware quantization, use:
python run_ppl_eval.py \
--model_name_or_path /Path/To/Palu/Model \
--datasets wikitext2 \
--seqlen 4096 \
--lt_bits 3 \
--lt_hadamard
For zero-shot evaluations, use the following command:
CUDA_VISIBLE_DEVICES=0 python run_lm_eval.py \
--model_name_or_path "/Path/To/Palu/Model" \
--tasks "openbookqa,hellaswag,piqa,arc_easy,arc_challenge,winogrande"
Evaluate the compressed model on long-bench tasks:
CUDA_VISIBLE_DEVICES=0 python run_long_bench.py \
--model_name_or_path /Path/To/Palu/Model
Evaluate the latency of the Palu-compressed attention module:
CUDA_VISIBLE_DEVICES=0 python run_latency_attention.py \
--rank_k 1024 --rank_v 3072 --group_size 4 \
--prompt_len 65536 --palu
Evaluate the latency of the reconstruction kernel:
CUDA_VISIBLE_DEVICES=0 python run_latency_kernel.py \
--total_rank 1024 --group_size 4
This compressed version of Meta Llama-3-8B-Instruct, powered by Palu, is optimized for memory efficiency without compromising performance. Whether you're working with large datasets or deploying models in memory-constrained environments, this setup is designed to provide robust results.