Run llama3 locally with 1M token context

https://ollama.com/library/llama3-gradient

This model extends LLama-3 8B's context length from 8k to over 1m tokens.

8b 70b

93.1K  Pulls Updated  7 months ago

Readme

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.

Large Context Window

Note: using a 256k context window requires at least 64GB of memory. Using a 1M+ context window requires significantly more (100GB+).

To extend the context window (to 256k for example) use:

API

curl http://localhost:11434/api/generate -d '{
  "model": "llama3-gradient",
  "prompt": "Why is the sky blue?",
  "options": {
    "num_ctx": 256000
  }
}'

CLI

ollama run llama3-gradient
>>> /set parameter num_ctx 256000

References

Website

Hugging Face

{
"by": "mritchie712",
"descendants": 72,
"id": 40215767,
"kids": [
40217234,
40218158,
40217669,
40216426,
40217360,
40216225,
40217926,
40218135,
40217244,
40220479,
40215978,
40217495
],
"score": 204,
"time": 1714508123,
"title": "Run llama3 locally with 1M token context",
"type": "story",
"url": "https://ollama.com/library/llama3-gradient"
}
{
"author": null,
"date": null,
"description": "This model extends LLama-3 8B’s context length from 8k to over 1m tokens.",
"image": "https://ollama.com/public/og.png",
"logo": null,
"publisher": null,
"title": "llama3-gradient",
"url": "https://ollama.com/llama3-gradient"
}
{
"url": "https://ollama.com/llama3-gradient",
"title": "llama3-gradient",
"description": "This model extends LLama-3 8B's context length from 8k to over 1m tokens. \t\t \t \t\t\t \t\t\t\t8b \t\t\t\t\t\t70b 93.1K \t\t\t\t\t\t Pulls ...",
"links": [
"https://ollama.com/llama3-gradient",
"https://ollama.com/library/llama3-gradient"
],
"image": "https://ollama.com/public/og-twitter.png",
"content": "<div>\n\t<div>\n\t\t<div>\n<div>\n\t<h2 id=\"summary-display\">\n\t\t<span>\n\t\t\tThis model extends LLama-3 8B's context length from 8k to over 1m tokens.\n\t\t</span>\n\t</h2>\n</div>\n\t\t\t<div>\n\t\t\t\t<p><span>8b</span>\n\t\t\t\t\t\t<span>70b</span>\n\t\t\t\t</p>\n\t\t\t\t<p>\n\t\t\t\t\t <span>\n\t\t\t\t\t\t<svg>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t<span>93.1K</span>\n\t\t\t\t\t\t<span> Pulls</span>\n\t\t\t\t\t </span>\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t<svg>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t<span>Updated </span>\n\t\t\t\t\t\t\t<span>7 months ago</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n <div>\n <p>\n </p><h2>Readme</h2>\n <p></p>\n <div>\n <p><img src=\"https://ollama.com/assets/library/llama3-gradient/11962db3-2750-4346-b89c-b9b5612cc76a\" /></p>\n<p>This model extends LLama-3 8B’s context length from 8k to &gt; 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 &lt; 0.01% of Llama-3’s original pre-training data.</p>\n<h2>Large Context Window</h2>\n<blockquote>\n<p>Note: using a 256k context window requires at least 64GB of memory. Using a 1M+ context window requires significantly more (100GB+).</p>\n</blockquote>\n<p>To extend the context window (to 256k for example) use:</p>\n<p><sub>API</sub></p>\n<pre><code>curl http://localhost:11434/api/generate -d '{\n \"model\": \"llama3-gradient\",\n \"prompt\": \"Why is the sky blue?\",\n \"options\": {\n \"num_ctx\": 256000\n }\n}'\n</code></pre>\n<p><sub>CLI</sub></p>\n<pre><code>ollama run llama3-gradient\n&gt;&gt;&gt; /set parameter num_ctx 256000\n</code></pre>\n<h2>References</h2>\n<p><a target=\"_blank\" href=\"https://gradient.ai/\">Website</a></p>\n<p><a target=\"_blank\" href=\"https://huggingface.co/gradientai/Llama-3-8B-Instruct-Gradient-1048k\">Hugging Face</a></p>\n </div>\n <div>\n <div>\n <p><label>\n Paste, drop or click to upload images (.png, .jpeg, .jpg, .svg, .gif)\n </label>\n </p>\n </div>\n </div>\n </div>\n</div>",
"author": "",
"favicon": "https://ollama.com/public/android-chrome-icon-512x512.png",
"source": "ollama.com",
"published": "",
"ttr": 33,
"type": "website"
}