Nearby lessons

37 of 49

Prompt 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
Loading editor…

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 PromptChatML
One-time inputMulti-turn
No memoryContext memory
SimpleConversational
LimitedAdvanced
Example02
Loading editor…

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
Loading editor…

Comparing All Four Formats

FormatStructureUse Case
PlainSimple textBasic prompting
AlpacaInstruction / Input / OutputModel training, datasets
ChatMLSystem / User / AssistantChatbots, conversations
INSTInstruction in [INST] tagsLLaMA / 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
Loading editor…
📝 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 Questions
Progress: 0 / 4

Finished this lesson?

Mark it as complete to track your progress and see technology completion stats.