Skip to content

Commit cb05f6e

Browse files
authored
Add files via upload
1 parent b8ba3e7 commit cb05f6e

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

recipes/quickstart/Prompt_Engineering_with_Llama_3.ipynb

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
"source": [
88
"<a href=\"https://colab.research.google.com/github/meta-llama/llama-recipes/blob/main/recipes/quickstart/Prompt_Engineering_with_Llama_3.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>\n",
99
"\n",
10-
"# Prompt Engineering with Llama 3\n",
10+
"# Prompt Engineering with Llama 3.1\n",
1111
"\n",
1212
"Prompt engineering is using natural language to produce a desired response from a large language model (LLM).\n",
1313
"\n",
14-
"This interactive guide covers prompt engineering & best practices with Llama 3."
14+
"This interactive guide covers prompt engineering & best practices with Llama 3.1."
1515
]
1616
},
1717
{
@@ -45,6 +45,15 @@
4545
"\n",
4646
"Llama models come in varying parameter sizes. The smaller models are cheaper to deploy and run; the larger models are more capable.\n",
4747
"\n",
48+
"#### Llama 3.1\n",
49+
"1. `llama-3.1-8b` - base pretrained 8 billion parameter model\n",
50+
"1. `llama-3.1-70b` - base pretrained 70 billion parameter model\n",
51+
"1. `llama-3.1-405b` - base pretrained 405 billion parameter model\n",
52+
"1. `llama-3.1-8b-instruct` - instruction fine-tuned 8 billion parameter model\n",
53+
"1. `llama-3.1-70b-instruct` - instruction fine-tuned 70 billion parameter model\n",
54+
"1. `llama-3.1-405b-instruct` - instruction fine-tuned 405 billion parameter model (flagship)\n",
55+
"\n",
56+
"\n",
4857
"#### Llama 3\n",
4958
"1. `llama-3-8b` - base pretrained 8 billion parameter model\n",
5059
"1. `llama-3-70b` - base pretrained 70 billion parameter model\n",
@@ -133,7 +142,7 @@
133142
"\n",
134143
"Tokens matter most when you consider API pricing and internal behavior (ex. hyperparameters).\n",
135144
"\n",
136-
"Each model has a maximum context length that your prompt cannot exceed. That's 8K tokens for Llama 3, 4K for Llama 2, and 100K for Code Llama. \n"
145+
"Each model has a maximum context length that your prompt cannot exceed. That's 128k tokens for Llama 3.1, 4K for Llama 2, and 100K for Code Llama.\n"
137146
]
138147
},
139148
{
@@ -143,7 +152,7 @@
143152
"source": [
144153
"## Notebook Setup\n",
145154
"\n",
146-
"The following APIs will be used to call LLMs throughout the guide. As an example, we'll call Llama 3 chat using [Grok](https://console.groq.com/playground?model=llama3-70b-8192).\n",
155+
"The following APIs will be used to call LLMs throughout the guide. As an example, we'll call Llama 3.1 chat using [Grok](https://console.groq.com/playground?model=llama3-70b-8192).\n",
147156
"\n",
148157
"To install prerequisites run:"
149158
]
@@ -171,8 +180,9 @@
171180
"# Get a free API key from https://console.groq.com/keys\n",
172181
"os.environ[\"GROQ_API_KEY\"] = \"YOUR_GROQ_API_KEY\"\n",
173182
"\n",
174-
"LLAMA3_70B_INSTRUCT = \"llama3-70b-8192\"\n",
175-
"LLAMA3_8B_INSTRUCT = \"llama3-8b-8192\"\n",
183+
"LLAMA3_405B_INSTRUCT = \"llama-3.1-405b-reasoning\" # Note: Groq currently only gives access here to paying customers for 405B model\n",
184+
"LLAMA3_70B_INSTRUCT = \"llama-3.1-70b-versatile\"\n",
185+
"LLAMA3_8B_INSTRUCT = \"llama3.1-8b-instant\"\n",
176186
"\n",
177187
"DEFAULT_MODEL = LLAMA3_70B_INSTRUCT\n",
178188
"\n",
@@ -225,7 +235,7 @@
225235
"source": [
226236
"### Completion APIs\n",
227237
"\n",
228-
"Let's try Llama 3!"
238+
"Let's try Llama 3.1!"
229239
]
230240
},
231241
{
@@ -488,7 +498,7 @@
488498
"\n",
489499
"Simply adding a phrase encouraging step-by-step thinking \"significantly improves the ability of large language models to perform complex reasoning\" ([Wei et al. (2022)](https://arxiv.org/abs/2201.11903)). This technique is called \"CoT\" or \"Chain-of-Thought\" prompting.\n",
490500
"\n",
491-
"Llama 3 now reasons step-by-step naturally without the addition of the phrase. This section remains for completeness."
501+
"Llama 3.1 now reasons step-by-step naturally without the addition of the phrase. This section remains for completeness."
492502
]
493503
},
494504
{
@@ -704,7 +714,7 @@
704714
"source": [
705715
"### Limiting Extraneous Tokens\n",
706716
"\n",
707-
"A common struggle with Llama 2 is getting output without extraneous tokens (ex. \"Sure! Here's more information on...\"), even if explicit instructions are given to Llama 2 to be concise and no preamble. Llama 3 can better follow instructions.\n",
717+
"A common struggle with Llama 2 is getting output without extraneous tokens (ex. \"Sure! Here's more information on...\"), even if explicit instructions are given to Llama 2 to be concise and no preamble. Llama 3.x can better follow instructions.\n",
708718
"\n",
709719
"Check out this improvement that combines a role, rules and restrictions, explicit instructions, and an example:"
710720
]

0 commit comments

Comments
 (0)