Datasets
EngineSurogate EngineYou point Surogate at your data under datasets (and optionally validation_datasets) and tell it which format each dataset is in. Surogate then applies the chat template, tokenizes and masks the data for you.
Dataset type can be:
text(pretraining / raw text)instruction(instruction/output)conversation(chat messages)preference({prompt, chosen, rejected}pairs for offline DPO)auto(auto-detect)
Every type loads through the same pipeline: path may be a local JSONL/JSON/parquet/CSV
file, a dataset directory, or a HuggingFace hub repo, and subset/split/samples
work the same way for all of them. If your column names differ from the defaults, map them
with the per-type field options (e.g. text_field, messages_field, chosen_field).
The examples below show one row of each format and the matching config. The full list of options for each type is in the config reference.
For pretraining or continued pretraining on raw text. Each row has one text column, text by default (text_field).
{"text": "The mitochondria is the powerhouse of the cell. ..."}datasets: - path: "HuggingFaceFW/fineweb-edu" type: text text_field: text split: train samples: 100000Instruction
Section titled “Instruction”For instruction-following data. instruction_field and output_field are required; input_field adds optional extra context. You can add a system prompt from a column (system_prompt_type: field) or the same one for every row (system_prompt_type: fixed).
{"instruction": "Translate to French.", "input": "Good morning", "output": "Bonjour"}datasets: - path: "yahma/alpaca-cleaned" type: instruction instruction_field: instruction input_field: input output_field: output system_prompt_type: fixed system_prompt: "You are a helpful AI assistant."Conversation
Section titled “Conversation”For multi-turn chat data. Each row has a list of messages, in the messages column by default (messages_field). system_field and tools_field point at optional system-prompt and tool-definition columns, and message_property_mappings handles messages that don’t use role/content.
{"messages": [{"role": "user", "content": "Hi!"}, {"role": "assistant", "content": "Hello! How can I help?"}]}datasets: - path: "HuggingFaceH4/ultrachat_200k" type: conversation messages_field: messages split: train_sftPreference
Section titled “Preference”For offline DPO with surogate dpo. Each row has a prompt (a string or a chat messages list) and two competing responses, chosen and rejected. The loss applies only to the response tokens.
{"prompt": "...", "chosen": "preferred response", "rejected": "dispreferred response"}datasets: - path: ./pairs.jsonl type: preferenceWith type: auto, Surogate looks at the columns: a conversation, conversations or messages column is read as chat data, instruction plus input columns as instruction data, and anything else as a plain response dataset. Set the type explicitly when you know it.
datasets: - path: ./data.jsonl type: autoSee also
Section titled “See also”- Config reference: datasets: every dataset option, plus packing and validation splits
- Quickstart: SFT: your first fine-tuning run, from a ready-made config
- Quickstart: DPO: train on preference pairs
- Back to docs index