Answers.Body: <p>Perhaps you could train an auxiliary binary classifier to predict whether or not a response from the chatbot was on or off topic. You could use text from the chapters that you fine tune the Q.A. model with to generate examples of &quot;on topic&quot; text and then use text from other sources as &quot;off topic&quot;.</p>
  <p>Then, when the model generates an output, you could pass that through the binary on/off-topic classifier. If it is deemed off topic, you could then respond with some canned phrases, indicating that the chatbot is unable to answer the specific question. I have not tried this myself, but it seems to me like a reasonable place to begin.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-23T14:30:29.780Z
Answers.Text: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Answers.UserDisplayName: Community
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-23T06:18:16.437Z
Answers.LastActivityDate: 2022-08-23T06:18:16.437Z
Answers.UserDisplayName: JeremyFromEarth
Body: <p>I’m thinking of fine-tuning a pre-trained language model for a Q&amp;A task. More specifically, I’d like to fine-tune the model on a single chapter in a classic college textbook. Afterward, the reader of the chapter should be able to engage in a Q&amp;A session with the model about the content of the chapter.</p>
  <p>But how do I make sure that the model stays on topic and doesn’t go out of a tangent? I know it is possible when looking at what <a href="https://play.aidungeon.io/" rel="nofollow noreferrer">https://play.aidungeon.io/</a> has achieved, but I don’t know if it will require me to build a model from the ground for each chapter. Can anyone tell me if I’m out of my mind or if it’s feasible?</p>
  <p>Edit:</p>
  <p>I've just learned that AI Dungeon's models has also struggled with a tendency to create graphic and sexual content despite not being prompted by players.</p>
  
Tags: <natural-language-processing><chat-bots>
Title: Can you make Q&A language model stay on topic?
UserDisplayName: Quantizer
ThreadText: # Can you make Q&A language model stay on topic?
  
  (Asked by: username_0 on 2022-08-19)
  
  I’m thinking of fine-tuning a pre-trained language model for a Q&A task. More specifically, I’d like to fine-tune the model on a single chapter in a classic college textbook. Afterward, the reader of the chapter should be able to engage in a Q&A session with the model about the content of the chapter.
  
  But how do I make sure that the model stays on topic and doesn’t go out of a tangent? I know it is possible when looking at what <https://play.aidungeon.io/> has achieved, but I don’t know if it will require me to build a model from the ground for each chapter. Can anyone tell me if I’m out of my mind or if it’s feasible?
  
  Edit:
  
  I've just learned that AI Dungeon's models has also struggled with a tendency to create graphic and sexual content despite not being prompted by players.
  
  **Tags:** natural-language-processing, chat-bots
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-08-23. Score: 0
  
  Perhaps you could train an auxiliary binary classifier to predict whether or not a response from the chatbot was on or off topic. You could use text from the chapters that you fine tune the Q.A. model with to generate examples of "on topic" text and then use text from other sources as "off topic".
  
  Then, when the model generates an output, you could pass that through the binary on/off-topic classifier. If it is deemed off topic, you could then respond with some canned phrases, indicating that the chatbot is unable to answer the specific question. I have not tried this myself, but it seems to me like a reasonable place to begin.
  
  > **Comments:**
  > **username_2**: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).  
  
  ---
  
  