Model reference · open weights
Llama-3-Gradient-1048k is an open-weight language model from gradientai. AxForge deploys and operates it for you on dedicated EU-owned hardware — with the licence handled where one is required.
Available as managed deployment — configured and operated for you on dedicated EU hardware, quoted per deployment.
What it is
| Released by | gradientai |
|---|---|
| Type | Language models |
| Task | Text gen |
| Parameters (lead) | 8.0B |
| Context | 1024k tokens |
| Runs with | transformers |
| Released | 2024-04-29 |
| Popularity | 36k downloads / month |
| Licence | Open, with conditions |
About
Join our custom agent and long context (262k-1M+) waitlist: https://forms.gle/L6TDY7dozx8TuoUv7
Gradient incorporates your data to deploy autonomous assistants that power critical operations across your business. If you're looking to build custom AI models or agents, email us a message contact@gradient.ai. For more info see our end-to-end development service for custom LLMs and AI systems
This model extends LLama-3 8B's context length from 8k to > 1040K, developed by Gradient, sponsored by compute from Crusoe Energy. It demonstrates that SOTA LLMs can learn to operate on long context with minimal training by appropriately adjusting RoPE theta. We trained on 830M tokens for this stage, and 1.4B tokens total for all stages, which is < 0.01% of Llama-3's original pre-training data.
Update (5/3): We further fine-tuned our model to strengthen its assistant-like chat ability as well.
Updated NIAH result:
RULER evals:
Approach:
Infra:
We build on top of the EasyContext Blockwise RingAttention library [3] to scalably and efficiently train on contexts up to 1048k tokens on Crusoe Energy high performance L40S cluster.
Notably, we layered parallelism on top of Ring Attention with a custom network topology to better leverage large GPU clusters in the face of network bottlenecks from passing many KV blocks between devices. This gave us a 33x speedup in model training (compare 524k and 1048k to 65k and 262k in the table below).
Data:
For training data, we generate long contexts by augmenting SlimPajama. We also fine-tune on a chat dataset based on UltraChat [4], following a similar recipe for data augmentation to [2].
Progressive Training Details:
| 65K | 262K | 524k | 1048k | |
|---|---|---|---|---|
| Initialize From | LLaMA-3 8B | 65K | 262K | 524k |
| Sequence Length 2^N | 16 | 18 | 19 | 20 |
| RoPE theta | 15.3 M | 207.1 M | 1.06B | 2.80B |
| Batch Size | 1 | 1 | 16 | 8 |
| Gradient Accumulation Steps | 32 | 16 | 1 | 1 |
| Steps | 30 | 24 | 50 | 50 |
| Total Tokens | 62914560 | 100663296 | 419430400 | 838860800 |
| Learning Rate | 2.00E-05 | 2.00E-05 | 2.00E-05 | 2.00E-05 |
| # GPUs | 8 | 32 | 512 | 512 |
| GPU Type | NVIDIA L40S | NVIDIA L40S | NVIDIA L40S | NVIDIA L40S |
| Minutes to Train (Wall) | 202 | 555 | 61 | 87 |
Evaluation:
EVAL_MAX_CONTEXT_LENGTH=1040200
EVAL_MIN_CONTEXT_LENGTH=100
EVAL_CONTEXT_INTERVAL=86675
EVAL_DEPTH_INTERVAL=0.2
EVAL_RND_NUMBER_DIGITS=8
HAYSTACK1:
EVAL_GENERATOR_TOKENS=25
HAYSTACK2:
EVAL_CONTEXT_INTERVAL=173350
EVAL_GENERATOR_TOKENS=150000
HAYSTACK3:
EVAL_GENERATOR_TOKENS=925000
All boxes not pictured for Haystack 1 and 3 are 100% accurate. Haystacks 1,2 and 3 are further detailed in this blog post.
Quants:
--max-model-len 32768https://gradient.ai/
Gradient is accelerating AI transformation across industries. Our AI Foundry incorporates your data to deploy autonomous assistants that power critical operations across your business.
Drop an email to contact@gradient.ai
@misc{gradientlongcontextllama3,
title={Llama 3 Gradient: A series of long context models},
author={Leonid Pekelis and Michael Feil and Forrest Moret and Mark Huang and Tiffany Peng},
year={2024},
url = {https://gradient.ai/blog/scaling-rotational-embeddings-for-long-context-language-models},
doi = { 10.57967/hf/3372 },
}
[1] Peng, Bowen, et al. "Yarn: Efficient context window extension of large language models." arXiv preprint arXiv:2309.00071 (2023).
[2] Liu, Hao, et al. "World Model on Million-Length Video And Language With RingAttention." arXiv preprint arXiv:2402.08268 (2024).
[3] https://github.com/jzhang38/EasyContext
[4] Ning Ding, Yulin Chen, Bokai Xu, Yujia Qin, Zhi Zheng, Shengding Hu, Zhiyuan Liu, Maosong Sun, and Bowen Zhou. Enhancing chat language models by scaling high-quality instructional conversations. arXiv preprint arXiv:2305.14233, 2023.
Meta developed and released the Meta Llama 3 family of large language models (LLMs), a collection of pretrained and instruction tuned generative text models in 8 and 70B sizes. The Llama 3 instruction tuned models are optimized for dialogue use cases and outperform many of the available open source chat models on co
From the published model card. Full card on the HuggingFace links in the sidebar.
Using it via the API
Once AxForge deploys llama-3-gradient-1048k for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (llama-3-gradient-1048k below is illustrative; you get the exact model name on deployment.)
$ curl -sS https://api.axforge.ai/v1/chat/completions \
-H "Authorization: Bearer $AXFORGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"llama-3-gradient-1048k","messages":[{"role":"user","content":"Hello"}]}'
Create an account — your API key is available in the console. 3M free tokens every 30 days with every new account.