princeton-nlp
commited on
Commit
•
99fa759
1
Parent(s):
c4420a2
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
---
|
4 |
+
license: apache-2.0
|
5 |
+
---
|
6 |
+
|
7 |
+
**Paper**: [Adapting Language Models to Compress Contexts](https://arxiv.org/abs/2305.14788)
|
8 |
+
|
9 |
+
**Code**: https://github.com/princeton-nlp/AutoCompressors
|
10 |
+
|
11 |
+
**Models**:
|
12 |
+
- Llama-2-7b fine-tuned models: [AutoCompressor-Llama-2-7b-6k](https://huggingface.co/princeton-nlp/AutoCompressor-Llama-2-7b-6k/), [FullAttention-Llama-2-7b-6k](https://huggingface.co/princeton-nlp/FullAttention-Llama-2-7b-6k)
|
13 |
+
- OPT-2.7b fine-tuned models: [AutoCompressor-2.7b-6k](https://huggingface.co/princeton-nlp/AutoCompressor-2.7b-6k), [AutoCompressor-2.7b-30k](https://huggingface.co/princeton-nlp/AutoCompressor-2.7b-30k), [RMT-2.7b-8k](https://huggingface.co/princeton-nlp/RMT-2.7b-8k), [FullAttention-2.7b-4k](https://huggingface.co/princeton-nlp/FullAttention-2.7b-4k)
|
14 |
+
- OPT-1.3b fine-tuned models: [AutoCompressor-1.3b-30k](https://huggingface.co/princeton-nlp/AutoCompressor-1.3b-30k), [RMT-1.3b-30k](https://huggingface.co/princeton-nlp/RMT-1.3b-30k)
|
15 |
+
|
16 |
+
---
|
17 |
+
|
18 |
+
FullAttention-2.7b-4k is a model fine-tuned from [facebook/opt-2.7b](https://huggingface.co/facebook/opt-2.7b) following the context window extension method described in [Adapting Language Models to Compress Contexts](https://arxiv.org/abs/2305.14788).
|
19 |
+
The 2,048 positional embeddings of the pre-trained OPT-2.7b are duplicated and the model is fine-tuned on sequences of 4,096 tokens from 2B tokens from [The Pile](https://pile.eleuther.ai).
|
20 |
+
|
21 |
+
To get started, download the [`AutoCompressor`](https://github.com/princeton-nlp/AutoCompressors) repository and load the model as follows:
|
22 |
+
|
23 |
+
```
|
24 |
+
from auto_compressor import AutoCompressorModel
|
25 |
+
|
26 |
+
model = AutoCompressorModel.from_pretrained("princeton-nlp/FullAttention-2.7b-4k")
|
27 |
+
```
|
28 |
+
|
29 |
+
**Evaluation**
|
30 |
+
|
31 |
+
We record the perplexity achieved by our OPT-2.7b models on segments of 2,048 tokens, conditioned on different amounts of context.
|
32 |
+
FullAttention-2.7-4k uses full uncompressed contexts whereas AutoCompressor-2.7b-6k and RMT-2.7b-8k compress segments of 2,048 tokens into 50 summary vectors.
|
33 |
+
|
34 |
+
*In-domain Evaluation*
|
35 |
+
|
36 |
+
| Context Tokens | 0 |512 | 2048 | 4096 | 6144 |
|
37 |
+
| -----------------------------|-----|-----|------|------|------|
|
38 |
+
| FullAttention-2.7b-4k | 6.57|6.15 |5.94 |- |- |
|
39 |
+
| RMT-2.7b-8k | 6.34|6.19 |6.02 | 6.02 | 6.01 |
|
40 |
+
| AutoCompressor-2.7b-6k | 6.31|6.04 | 5.98 | 5.94 | 5.93 |
|
41 |
+
|
42 |
+
*Out-of-domain Evaluation*
|
43 |
+
|
44 |
+
| Context Tokens | 0 |512 | 2048 | 4096 | 6144 |
|
45 |
+
| -----------------------------|-----|-----|------|------|------|
|
46 |
+
| FullAttention-2.7b-4k | 8.94|8.28 |7.93 |- |- |
|
47 |
+
| RMT-2.7b-8k | 8.62|8.44 |8.21 | 8.20 | 8.20 |
|
48 |
+
| AutoCompressor-2.7b-6k | 8.60|8.26 | 8.17 | 8.12 | 8.10 |
|
49 |
+
|
50 |
+
|
51 |
+
## Bibtex
|
52 |
+
```
|
53 |
+
@misc{chevalier2023adapting,
|
54 |
+
title={Adapting Language Models to Compress Contexts},
|
55 |
+
author={Alexis Chevalier and Alexander Wettig and Anirudh Ajith and Danqi Chen},
|
56 |
+
year={2023},
|
57 |
+
eprint={2305.14788},
|
58 |
+
archivePrefix={arXiv},
|
59 |
+
primaryClass={cs.CL}
|
60 |
+
}
|
61 |
+
```
|