Nearby lessons
37 of 49Prompt Engineering - Alpaca, ChatML and INST Formats
Alpaca Format — Instruction / Input / Output
The Alpaca template is a structured format used to train AI models, with three clear parts:
- Instruction — what to do.
- Input — additional context.
- Output — expected result.
It makes datasets consistent and improves instruction understanding.
In simple words: Instruction + Input + Output = perfect structure. Structured learning creates powerful systems.
The homework example:
- Instruction = write about planets.
- Input = focus on Earth and Mars.
- Output = 5 points.
Clear structure gives a clear answer — whether for a student or an AI model being fine-tuned.
Example01
ChatML Format — Role-Based Conversations
ChatML is the structured format for conversations in systems like ChatGPT. It uses roles — system, user, assistant — so AI can remember context across multiple turns.
- Enables real multi-step interaction.
- Best for chatbots and conversations.
In simple words: ChatML brings conversation into AI. Communication builds intelligence.
| Plain Prompt | ChatML |
|---|---|
| One-time input | Multi-turn |
| No memory | Context memory |
| Simple | Conversational |
| Limited | Advanced |
Example02
INST Format — LLaMA Style
The INST format wraps the instruction inside special tags and is used by LLaMA and open-source models. It is a lightweight format with no roles — just the instruction inside [INST] ... [/INST].
The exam-sheet example:
- A question placed inside a box is easy to identify.
- The instruction inside tags works the same way — the model knows exactly where the task begins and ends.
Example03
Comparing All Four Formats
| Format | Structure | Use Case |
|---|---|---|
| Plain | Simple text | Basic prompting |
| Alpaca | Instruction / Input / Output | Model training, datasets |
| ChatML | System / User / Assistant | Chatbots, conversations |
| INST | Instruction in [INST] tags | LLaMA / open-source models |
Trainer's Note: Choose the format based on the model and the use case: ChatML for chat apps, Alpaca for datasets and training, INST for LLaMA models, plain for quick basic tasks.
Example04
📝 Key Takeaways
- Alpaca = Instruction + Input + Output (model training and datasets).
- ChatML = System / User / Assistant with context memory.
- INST wraps instructions in [INST] tags for LLaMA models.
- ChatML is best for chatbots and conversations.
- Alpaca is best for dataset creation and training.
- Choose the format based on the model and the use case.
🧠 Test Your Knowledge
4 QuestionsProgress: 0 / 4