# DPO with Chat Data

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdpo-with-chat-data%2F79638%3E%5C
**Category:** Intermediate\
**Created:** [April 1, 2024, 10:24am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdpo-with-chat-data%2F79638 "2024-04-01T10:24:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![batuhan83](https://avatars.discourse-cdn.com/v4/letter/b/dfb087/32.png) [@batuhan83](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbatuhan83)%5C
**Post date:** [April 1, 2024, 10:24am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdpo-with-chat-data%2F79638%2F1 "2024-04-01T10:24:29Z")

</div>

Hi,

I am curious about training an LLM using DPO on a chat dataset. I have a chat dataset with messages between a user and an assistant. I want to create the DPO dataset with ‘prompt’, ‘chosen’, and ‘reject’ fields, where the ‘chosen’ entries are the assistant’s responses, and the ‘reject’ entries are generated by an SFT model I trained. However, I’m having difficulty constructing this dataset. Should each assistant turn in one chat be treated as a separate data sample with the entire chat history in its prompt? Or is there a more efficient way to format these prompts for DPO? Any guidance would be greatly appreciated!
