# Train back and forth dialogues

**URL:** <https://community.openai.com/t/train-back-and-forth-dialogues/15593>\
**Category:** Prompting\
**Created:** [February 23, 2022, 3:57pm UTC](https://community.openai.com/t/train-back-and-forth-dialogues/15593 "2022-02-23T15:57:09Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![lechnerf](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/lechnerf/32/8235_2.png) [@lechnerf](https://community.openai.com/u/lechnerf)\
**Post date:** [February 23, 2022, 3:57pm UTC](https://community.openai.com/t/train-back-and-forth-dialogues/15593/1 "2022-02-23T15:57:10Z")

</div>

Hello everyone,

i am currently working on my master’s thesis and wanted to fine tune a GPT-3 Curie chatbot.  
I suceeded, but because i used Q&A style dialogues a single input provoces a total “conversation finishing answer”.  
But i wanted to give it a more chatbotty feel and found a dataset, where the answer part actually asks questions back and the conversation goes on for a couple of iterations between two parties.  
Because the finetuning model requires a “prompt/completion” style input thogh i don’t know how to finetune curie to keep the context of the conversation.

I hope this is in any way understandable, it’s quite the complicated problem.

Thank you for your help 🙂

---

<div class="post-metadata">

**Author:** ![sps](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/sps/32/7736_2.png) [@sps](https://community.openai.com/u/sps)\
**Post date:** [February 23, 2022, 4:46pm UTC](https://community.openai.com/t/train-back-and-forth-dialogues/15593/2 "2022-02-23T16:46:58Z")

</div>

Hi @lechnerf

This “memory” problem of GPT-3 is very common for the chatbot scenario. There’ve been quite some post on the community with potential solutions involving using GPT-3 to condense/summarize the previous conversation to retain context, so as to make the most out of it.

My hypothesis is that it can be solved with a “rolling memory” i.e. remember the most recent N tokens. I haven’t got a chance to test it out though as my grant expired in October last year.

---

<div class="post-metadata">

**Author:** ![lechnerf](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/lechnerf/32/8235_2.png) [@lechnerf](https://community.openai.com/u/lechnerf)\
**Post date:** [February 23, 2022, 5:14pm UTC](https://community.openai.com/t/train-back-and-forth-dialogues/15593/3 "2022-02-23T17:14:12Z")

</div>

@sps Thank you for the answer.

I will now lable the entire conversation before the last sentence as “prompt” and try to finetune a curie model. We’ll see how this works out.

---

<div class="post-metadata">

**Author:** ![sps](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/sps/32/7736_2.png) [@sps](https://community.openai.com/u/sps)\
**Post date:** [February 23, 2022, 5:40pm UTC](https://community.openai.com/t/train-back-and-forth-dialogues/15593/4 "2022-02-23T17:40:24Z")

</div>

In my last response, the potential solutions I suggested are to be used for the conversation and not for fine-tuning the model.

> [@lechnerf](#):
>
> I will now lable the entire conversation before the last sentence as “prompt”

Yes, do this with the existing fine-tuned model you have. Though you will quickly run out of tokens with every single dialogue between user and bot. Hence the need to condense.

---

<div class="post-metadata">

**Author:** ![marc.gehring](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/marc.gehring/32/75_2.png) [@marc.gehring](https://community.openai.com/u/marc.gehring)\
**Post date:** [March 1, 2022, 4:26pm UTC](https://community.openai.com/t/train-back-and-forth-dialogues/15593/5 "2022-03-01T16:26:34Z")

</div>

hey, marcbe we can get in touch. [marc.gehring@icloud.com](mailto:marc.gehring@icloud.com)

---

<div class="post-metadata">

**Author:** ![antonio.ciolino](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/antonio.ciolino/32/4230_2.png) [@antonio.ciolino](https://community.openai.com/u/antonio.ciolino)\
**Post date:** [March 2, 2022, 5:25pm UTC](https://community.openai.com/t/train-back-and-forth-dialogues/15593/6 "2022-03-02T17:25:17Z")

</div>

I’ve been using the rolling memory idea - it’s “good”, but it’s surprising how far back a conversation really goes, even with summarization, which quickly renders this process obsolete after 4 or 5 “events” from my ad-hoc experiments.

---

<div class="post-metadata">

**Author:** ![sps](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/sps/32/7736_2.png) [@sps](https://community.openai.com/u/sps)\
**Post date:** [March 2, 2022, 5:48pm UTC](https://community.openai.com/t/train-back-and-forth-dialogues/15593/7 "2022-03-02T17:48:04Z")

</div>

Yes that’s kinda expected, given the token limit. Another one of my hypothesis would be using embeddings, this should give significant room for memory.  
Here’s how this would go:

1. The latest conversation is appended to an archive.
2. At every point the human’s message is used to search and rank N semantically similar lnes from the archive.
3. Then these N lines are given to completion engine as context to generate the response.
4. The generated response is sent back to human as the message reply.

Note that this will require figuring out the prompt(s) that get the completion engine to generate appropriate response.

---

<div class="post-metadata">

**Author:** ![antonio.ciolino](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/antonio.ciolino/32/4230_2.png) [@antonio.ciolino](https://community.openai.com/u/antonio.ciolino)\
**Post date:** [March 2, 2022, 6:10pm UTC](https://community.openai.com/t/train-back-and-forth-dialogues/15593/8 "2022-03-02T18:10:39Z")

</div>

I started down a similar path but abandoned it for the same reason I don’t use the /answers endpoint: too many calls (and the costs get high fast), as well as poor performance (out of /answers). Now, I haven’t tried embeddings, so there might be something to this I haven’t experimented with, but if it requires an upload of files to be the data source, that could take too long to realistically use.

---

<div class="post-metadata">

**Author:** ![sps](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/sps/32/7736_2.png) [@sps](https://community.openai.com/u/sps)\
**Post date:** [March 2, 2022, 6:16pm UTC](https://community.openai.com/t/train-back-and-forth-dialogues/15593/9 "2022-03-02T18:16:29Z")

</div>

True. But if it’s done in a chat interface, the wait time can be covered with some kind of `typing...` or other UX

---

<div class="post-metadata">

**Author:** ![antonio.ciolino](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/antonio.ciolino/32/4230_2.png) [@antonio.ciolino](https://community.openai.com/u/antonio.ciolino)\
**Post date:** [March 2, 2022, 6:17pm UTC](https://community.openai.com/t/train-back-and-forth-dialogues/15593/10 "2022-03-02T18:17:16Z")

</div>

I meant file upload is painfully slow, and having the data processed takes time. If done in batches over 30 mins or so…maybe.

---

<div class="post-metadata">

**Author:** ![sps](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/sps/32/7736_2.png) [@sps](https://community.openai.com/u/sps)\
**Post date:** [March 2, 2022, 6:22pm UTC](https://community.openai.com/t/train-back-and-forth-dialogues/15593/11 "2022-03-02T18:22:33Z")

</div>

I don’t know how is it taking ~30min on your end but on my end it takes like ~10 seconds to upload a file and get a response when I’m using I the /answers api. My guess is that using embeddings and doing the whole procedure, shouldn’t take more than a minute.

Also you can cut the majority of that time when the data is saved on cloud like AWS/Azure etc.

---

<div class="post-metadata">

**Author:** ![antonio.ciolino](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/antonio.ciolino/32/4230_2.png) [@antonio.ciolino](https://community.openai.com/u/antonio.ciolino)\
**Post date:** [March 2, 2022, 6:23pm UTC](https://community.openai.com/t/train-back-and-forth-dialogues/15593/12 "2022-03-02T18:23:47Z")

</div>

Possibly because I’m thinking of the fine tuning indexing process. File uploads are fast, though the answers API is, as I mentioned, slightly costlier.

---

<div class="post-metadata">

**Author:** ![sps](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/sps/32/7736_2.png) [@sps](https://community.openai.com/u/sps)\
**Post date:** [March 2, 2022, 6:26pm UTC](https://community.openai.com/t/train-back-and-forth-dialogues/15593/13 "2022-03-02T18:26:39Z")

</div>

The /answers API I mentioned is just for reference. Also one definitely should not fine-tune a model every time the user sends a message.

---

<div class="post-metadata">

**Author:** ![brkrabac](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/brkrabac/32/10095_2.png) [@brkrabac](https://community.openai.com/u/brkrabac)\
**Post date:** [March 15, 2022, 8:26pm UTC](https://community.openai.com/t/train-back-and-forth-dialogues/15593/14 "2022-03-15T20:26:45Z")

</div>

One of the things I’ve found to be helpful is to pass the chat history so far, plus the new interaction and ask it to rewrite the new interaction to leverage the context from the chat history. This is a separate prompt/api call. Then you get a single question you can pass through the rest of your pipeline, avoid it becoming self-reinforcing, but still including the important references.

---

<div class="post-metadata">

**Author:** ![curt.kennedy](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/curt.kennedy/32/709249_2.png) [@curt.kennedy](https://community.openai.com/u/curt.kennedy)\
**Post date:** [December 17, 2023, 5:46pm UTC](https://community.openai.com/t/train-back-and-forth-dialogues/15593/15 "2023-12-17T17:46:16Z")

</div>


