intfloat commited on
Commit
d19b94e
·
verified ·
1 Parent(s): 2a75a63

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +92 -3
README.md CHANGED
@@ -1,3 +1,92 @@
1
- ---
2
- license: llama3.2
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: llama3.2
3
+ ---
4
+
5
+ # SelfLong-Llama3.2-1B-Instruct-1M
6
+
7
+ Wang, Liang, Nan Yang, Xingxing Zhang, Xiaolong Huang, and Furu Wei. "[Bootstrap Your Own Context Length.](https://arxiv.org/pdf/2412.18860)" arXiv preprint arXiv:2412.18860 (2024).
8
+
9
+ ## Overview
10
+
11
+ The SelfLong series of Large Language Models (LLMs) are designed to handle extremely long contexts, reaching up to 1 million tokens. These models, with parameter sizes of 1B, 3B, and 8B, are initialized from the Llama-3.2 and Llama-3.1 architectures.
12
+
13
+ ## Performance (RULER-1M)
14
+
15
+ The following table presents the results of the SelfLong models on the [RULER-1M benchmark](https://huggingface.co/datasets/self-long/RULER-llama3-1M). The numbers represent the RULER score averaged over 13 tasks at different support lengths.
16
+
17
+ | Model | Support Length | 32k | 64k | 128k | 256k | 512k | 1M |
18
+ |:----------------------| :------------- | :--- | :--- | :--- | :--- | :--- | :--- |
19
+ | Llama-3.2-1B-Instruct | 128k | 64.7 | 43.1 | 0.0 | - | - | - |
20
+ | Llama-3.2-3B-Instruct | 128k | 77.8 | 70.4 | 0.8 | - | - | - |
21
+ | Llama-3.1-8B-Instruct | 128k | **89.8** | **85.4** | <ins>78.5</ins> | - | - | - |
22
+ | gradientai/Llama-3-8B-Instruct-Gradient-1048k | 1M | 81.8 | 78.6 | 77.2 | <ins>74.2</ins> | <ins>70.3</ins> | <ins>64.3</ins> |
23
+ | **SelfLong-1B-1M** | 1M | 61.3 | 56.6 | 54.7 | 46.7 | 40.7 | 31.1 |
24
+ | **SelfLong-3B-1M** | 1M | 80.5 | 78.0 | 75.5 | 68.8 | 58.5 | 38.8 |
25
+ | **SelfLong-8B-1M** | 1M | <ins>89.5</ins> | <ins>84.0</ins> | **82.0** | **79.7** | **78.2** | **69.6** |
26
+
27
+ **Note:**
28
+
29
+ * **Bold** indicates the best performance.
30
+ * <ins>Underline</ins> indicates the second-best performance.
31
+ * `-` indicates that the model does not support the given context length.
32
+
33
+ ## Evaluation on RULER-1M Dataset
34
+
35
+ To evaluate the SelfLong models on the RULER-1M dataset, you can follow these steps:
36
+
37
+ 1. Start vllm server:
38
+
39
+ ```bash
40
+ PROC_PER_NODE=$(nvidia-smi --list-gpus | wc -l)
41
+ # Reduce this number if you have limited GPU memory
42
+ MAX_MODEL_LEN=1048576
43
+ MODEL_NAME_OR_PATH="self-long/SelfLong-Llama3.2-1B-Instruct-1M"
44
+
45
+ echo "Starting VLLM server..."
46
+ vllm serve "${MODEL_NAME_OR_PATH}" \
47
+ --dtype auto \
48
+ --disable-log-stats --disable-log-requests --disable-custom-all-reduce \
49
+ --enable_chunked_prefill --max_num_batched_tokens 8192 \
50
+ --tensor-parallel-size "${PROC_PER_NODE}" \
51
+ --max-model-len "${MAX_MODEL_LEN}" \
52
+ --gpu_memory_utilization 0.9 \
53
+ --api-key token-123 &
54
+ ```
55
+
56
+ 2. Get Completions
57
+ ```python
58
+ from openai import OpenAI
59
+ from datasets import load_dataset
60
+
61
+ client = OpenAI(
62
+ base_url="http://localhost:8000/v1", # Default vLLM server address
63
+ api_key="token-123"
64
+ )
65
+
66
+ ds = load_dataset('self-long/RULER-llama3-1M', f'niah_single_1_4k', split='validation')
67
+ prompt = ds[0]['input']
68
+
69
+ completion = client.completions.create(
70
+ model='self-long/SelfLong-Llama3.2-1B-Instruct-1M',
71
+ prompt=prompt,
72
+ max_tokens=100,
73
+ )
74
+
75
+ print(prompt)
76
+ print(completion.choices[0].text)
77
+ ```
78
+
79
+ 3. For evaluation, please refer to the evaluation script provided in the RULER repository: [https://github.com/NVIDIA/RULER/blob/main/scripts/eval/evaluate.py](https://github.com/NVIDIA/RULER/blob/main/scripts/eval/evaluate.py).
80
+
81
+ Note that different vLLM and Torch versions may produce slightly different decoding results.
82
+
83
+ ## References
84
+
85
+ ```
86
+ @article{wang2024bootstrap,
87
+ title={Bootstrap Your Own Context Length},
88
+ author={Wang, Liang and Yang, Nan and Zhang, Xingxing and Huang, Xiaolong and Wei, Furu},
89
+ journal={arXiv preprint arXiv:2412.18860},
90
+ year={2024}
91
+ }
92
+ ```