How to prevent ChatGPT from answering questions that are outside the scope of the provided context in the SYSTEM role message?

To add to @AgusPG’s thoughtful post, I’d say that when it comes to prompting, negatives usually don’t work as they contain the words you want to limit and therefore it’s more likely they’ll be output.

Also, ChatML seems to really be helping… I like the direction it’s going in.

3 Likes

Wow… thanks! it sounds a bit exaggerated. But you can be sure that if i feel desperate again the next days, i will try in this way. I tagged your post as favorite, to get it fast if i need it :grin:

I say this because i have already a direct SYSTEM instruct in the same way, passed as a previous message with role SYSTEM to the API, and it really seems to be pretty ignored :pensive: because the results are very disappointing.

1 Like

I use the term "If the answer is not in the context, say the word “Unknown”.

And then I do post processing and swap the word Unknown for text I want the user to see

Eg: Sorry but that is outside my scope of knowledge

I also put this in the USER part - not the SYSTEM part (Not sure if that makes a difference)

I’m not very sure that you’re right. Let me put some cases.

It works always perfect for me (using chatGPT Plus UI) when i add a NEGATIVE post-prompt like “Do not explain to me the modifications you do.”, for example when i request to it to improve a text in english (english is not my native language).

It complies very well with this instruction. It do not explain to me the modifications, only fix the text. But if you don’t specify this negative direct instruct at the end, USUALLY (not always) it add a long justification of obvious modifications that are not necessary. You know.

So, let me disagree with you. I think that negative direct instruct are very effective. And let me add: maybe because precisely as you said, it has more present what not to say.

1 Like

I know what you say. I use this other “trick” and it works better: to your “Unknow” i add an UTF8 smiley, like :thinking: or :sweat_smile: which is not “modifiable” in no way (no genre, no singular/plural, etc…). And it let me detect this kind of scenarios to improve the answer to user with extra-tips not provided by the IA :wink:

Note: Actually, I take this idea from Bing Chat, when I saw that they used emojis! Until that moment it had not occurred to me that this was possible. :grin:

2 Likes

The emoji is a great idea. Sometimes my Unknown turns into a sentence when the AI goes off on its own journey. Luckily it normally makes sense anyway

1 Like

Hi, one very important parameter is not mentioned in this thread so far but in my understanding is of very high importance! This is the “Presence penalty”-parameter. Turning this up will increase tge models likelihood to talk about new topics, so have you allready tried this out?

Also maybe turn down the temperature param?

And one thing to add: Try to give your command before the other input. In my experience the commands are more prioritized when they are given before the other text. This makes sense to me because if you say translate a text and in the following Text there is some text which might also be interpreted as a command it makes sense to prioritze the Translation command because this comes first.

For me this mix of tools works well enough - let me know if this is for you also the case :slight_smile:

1 Like

I didn’t say it never works, but sometimes it can be less productive than thinking about things in a positive rather than negative sense. As a LLM, it’s just taking the text you enter and returning relevant stuff. Just sharing my experience…

Again, though, I’m not saying it never works, but it’s sometimes easier to go in the other direction.

2 Likes

Yeah, you have pointed out an important detail to keep in mind: some user requests can involve long texts embedded in it. So in these cases to use a “post-prompt” concatenated to the raw user request couldn’t have sense.

But in my case (an smart auto-responder based on Q&A format queries) i think this is not a “able” scenario. But thanks to point it out. Because it’s necessary to take in account in future API calls for other uses, like translations, grammar corrections, requests to summarize, etc. Yeap.

I have both parameters at 0.1 (temperature and top_p).

Yes, I understood your comment, sorry if it seemed that I had understood it in a literal way. We both know that it’s not a question of white or black.

Said this, i am really counting the hours to launch to public BeeHelp, to begin to test intensively my built in different knowledge and case use and be able to improve the calls to API in relation to all these questions and difficulties.

I realize that i need to add a clear disclaimer message to these new customers regarding a this initial “beta” phase. I also count with OpenAI guys improving a lot the next versions of chatGPT (hopefully only a flatter language model, not “so conversational”!!) in the current weeks or couple of months :thinking:

1 Like

I just want to say that it’s a nice use case :slight_smile:

1 Like

People, next episode of caos30 taming the horse called chatGPT completion endpoint :stuck_out_tongue_winking_eye:

You’re invited to read it and help me with your smart point of view :grin:
You know that you’re very welcome.

Have you tried building the prompt with semantic search?

Interesting, but not. It’s the first time i read something like this.

Are you thinking of do a FIRST call to chatGPT completion endpoint asking for “rewrite” the user question taking in account some extra context information, like the closest Q&A in the knowledge database, and then use the output to do a SECOND answer.

Well, although it was minimum successful, this could almost double the cost of the use of the API and just the goal is just the opposite: to avoid consume API for OUT OF SCOPE questions, detecting it before to query API if it’s possible, or if it happen, then be able to respond that discourages the user to continue doing this kind of questions.

See it from the sky: we try to optimize the answers and the cost of the system to nicely attend users doing questions within the scope of our knowledge DB, discouraging other kind of questions.

In this sense, i’m not worried about the system responding to a COUPLE OF out of scope user questions, but i do worry about potential users using the system to get all day at any hour any kind of answer.

Yeah… it’s more complicated than initially seemed :sweat_smile:

You need to use embeddings to find the closest documents in your data source, not chatgpt, embeddings is a lot cheaper and faster also fyi.

For example

This is from a tuto i wrote Build a ChatGPT Powered Markdown Documentation in No Time | by louis030195 | Mar, 2023 | Better Programming

1 Like

Yes Louis, i’m using it already, since the beginning of this project.
But it is not enough when:

  1. Your knowledge repository is enough “semantic wide”, so when ALWAYS there is something “enough” close (using embeddigns) to the user question.

  2. When the user request is semantically very close to something on your knowledge but it really the real question of the user is far away in “some respect” to your core knowledge. Example: you have knowledge about your premium plan for your service, and the user request: give me a plan to build a premium service for my business.

In these scenarios the embeddings doesn’t avoid that chatGPT completion endpoint give a so good and long elaborated answer as your user request to it. Do you understand me?

Final thougths: i think that maybe you need to see this new “user assistance technology” just like we understand the human attention we receive in a classical physical commerce. I means: you cannot do many thinks (or nothing?) to avoid that entry in your commerce a guy asking foolishness and wasting the time of your friendly custom support guys. Can you?

So, in the same sense, we cannot avoid always that anyone could ask to chat assistant things out of scope… from time to time :sweat_smile:

Good addition I’ll probably add it in. I wish there was a way to make it stop saying “in conclusion” I’ve tried negative and I’ve tried all caps. When I did that it gave me this line “In conclusion (just kidding I won’t use that term again”. I was like… Look at this AI. It’s got jokes. It actually was very irritating. I haven’t tried Chat 4 because having so little prompts to use makes it just not something I want to try, because if it’s better and I like it. I’m limited (even though I’m paying for it). So, not useful. But there’s so many times it uses tired phrases and just keeps doing it no matter what.

Although, it also has that bad habit of hallucinating no matter what I tell it. I ask it not to add something and it’ll rephrase and add it anyway. It’s frustrating. (Makes you want to run it locally pulling from it’s own pile of things it can and can’t talk about.) :smiley:

Maybe that feature it suggested should be something you can do for an upgraded membership package. It’s a good idea. Just saying…

Some really good suggestions by @AgusPG in his link – we’ve tried a bunch of those with some excellent results.

So basically, try your best to control these parameters

  1. Prompt engineering
  2. Context
  3. Post-response filtering/similarity.

In our case, our system (CustomGPT) is used mostly for such use cases with customer data and they want the responses to be based on that data (with no hallucinating!) – e.g Customer Service Livechat.

1 Like