DevTools Logo

Instruction Dataset Converter

Instruction Dataset Converter

Convert Alpaca, ShareGPT and OpenAI fine-tuning datasets with role-aware mapping and explicit lossy-change warnings.

Runs in your browser
Try an example

Source dataset

2 row(s) · detected alpaca (0.90) · 2 lines · 126 chars
How source fields map to the chosen target
Source fieldActionTarget
instructionmappeduser turn
inputmergedappended to user turn
outputmappedassistant turn

Conversion

2 out · 1 lossy · 0 skipped

Row 1

Before: {"instruction":"Summarize","input":"München — “quotes”","output":"Kurz."}

After: {"conversations":[{"from":"human","value":"Summarize\n\n<input>\nMünchen — “quotes”\n</input>"},{"from":"gpt","value":"Kurz."}]}

Row 2

Before: {"instruction":"Greet","input":"","output":"Hallo!"}

After: {"conversations":[{"from":"human","value":"Greet"},{"from":"gpt","value":"Hallo!"}]}

Everything is converted locally; no dataset content is uploaded or stored.

Examples

Alpaca to messages

Input
{"instruction":"Summarize","input":"Article","output":"Summary"}
Output
{"messages":[{"role":"user","content":"Summarize\n\nArticle"},{"role":"assistant","content":"Summary"}]}

Input text is merged into the user message; output becomes the assistant reply.

Multi-turn collapse

Input
Four ShareGPT turns with two assistant answers
Output
One Alpaca row with 'answer1 [TURN] answer2'

The warning tells you the source conversation cannot round-trip.

Ollama export

Input
System + user + assistant conversation
Output
TEMPLATE with {{ .System }} / {{ .Prompt }} and PARAMETER stop lines

Use the downloaded Modelfile snippet as a starting point for ollama create.

About this tool

Instruction Dataset Converter translates fine-tuning rows between Alpaca, ShareGPT, OpenAI messages and an Ollama TEMPLATE/Modelfile skeleton. Each line is inspected independently, so mixed datasets are handled without a global format assumption.

The mapping matrix shown before conversion spells out which fields become roles, which fields are merged and which are lost. Common role vocabularies — human/gpt, user/assistant, bot and their colon-prefixed variants — normalize automatically.

Lossy transformations are first-class outputs: multi-turn conversations collapsed into a single Alpaca example, system prompts folded into the instruction, unknown roles skipped, and empty required fields all carry typed per-row warnings. Conversion runs locally; no dataset is uploaded.

What this tool does not do

  • Ollama output is a template skeleton, not a full model configuration.
  • Multi-turn to Alpaca is inherently lossy and joins turns with a separator.
  • Unknown roles are skipped rather than guessed.
  • Tool calls and non-text content parts are not transported.
  • Duplicate JSON keys follow JSON.parse last-wins semantics.

How to use this tool

  1. Paste the dataset

    Use JSONL (one object per line) or a JSON array. Bad lines are reported with their line number.

  2. Pick a target

    Choose OpenAI messages, ShareGPT, Alpaca or Ollama TEMPLATE and read the mapping matrix.

  3. Set conversion options

    Configure the multi-turn separator and whether Alpaca input gets an explicit Input: marker.

  4. Review and export

    Check the per-row action and warning table, then copy or download the converted JSONL or Modelfile.

Use cases

Cross-framework migration

Move a dataset from Axolotl-style Alpaca rows to OpenAI chat fine-tuning.

Local model preparation

Generate an Ollama Modelfile template from an existing instruction set.

Dataset audit

See exactly which fields are lost when converting to a narrower dialect.

Conversion rules

SourceMapping
Alpaca inputPrefixed to the user turn as instruction\n\ninstructionText (marker optional).
ShareGPT fromhuman → user, gpt → assistant, system → system; unknown values skipped.
OpenAI messagesRoles preserved; content strings carried verbatim.
prompt / completionSingle user turn plus single assistant turn.
Multi-turn → AlpacaAssistant replies joined with the configurable separator; WARN_LOSSY.
Ollama targetSystem + {{ .Prompt }} + response scaffolding; middle turns joined.

The default separator is [TURN]; collisions with existing content are reported as WARN_LOSSY.

Common mistakes

Mistake:Assuming Alpaca supports multi-turn conversations.

Fix:Read the WARN_LOSSY rows; use OpenAI or ShareGPT as the interchange format when turns matter.

Mistake:Forgetting that system prompts become prefixes in Alpaca.

Fix:Review the folded instruction text and keep the original dataset as the source of truth.

Mistake:Using a separator that appears in the content.

Fix:Choose a distinctive separator; the tool warns about collisions.

Mistake:Expecting custom from-vocabularies to work automatically.

Fix:Unknown roles are skipped with a warning; normalize them in the source or extend the role map.

Mistake:Believing conversion is reversible.

Fix:Lossy rows explicitly report what cannot round-trip; keep the original file.

Frequently asked questions

What gets lost converting multi-turn to Alpaca?

Alpaca has a single instruction, input and output field, so a conversation becomes one example. The tool joins user turns into the instruction and assistant replies into the output using a configurable separator. Every affected row is marked WARN_LOSSY with the exact reason, because that shape cannot round-trip back to the original conversation.

How is the Alpaca input field mapped?

Input text is appended to the user turn after a blank line, producing instruction\n\ninput. With the 'Keep input marker' option the join is instruction\n\nInput:\ninput instead, which is easier to undo. The converter never drops a non-empty input field silently.

Which formats does Axolotl or Llama-Factory expect?

Both frameworks support several datasets; Alpaca-style instruction/input/output rows and ShareGPT-style conversations are the most common. This tool emits both plus OpenAI messages so you can match the loader your configuration uses. Check your framework's docs for the exact file name and chat-template pairing.

What is the Ollama TEMPLATE syntax here?

The Ollama export emits a Modelfile skeleton with a TEMPLATE block containing {{ .System }} and {{ .Prompt }}, plus PARAMETER stop lines. The conversation's system message becomes the SYSTEM section; user turns populate the prompt slot and assistant turns the response. Middle turns are joined with the separator and reported as lossy.

How are unknown roles handled?

Known vocabularies such as human/gpt, user/assistant, bot and their colon-prefixed forms map automatically. Anything else is skipped with a WARN_SKIP entry naming the role and row, rather than guessed. Empty required fields produce WARN_EMPTY but the row is still emitted so you can repair it downstream.

Is my dataset uploaded anywhere?

No. Parsing, dialect detection, role mapping, warning generation and downloads all happen in your browser tab. No server sees the dataset, and converting it does not persist it after you leave the page.

References & standards