Sitemap

Level Up Coding

Coding tutorials and news. The developer homepage gitconnected.com && skilled.dev && levelup.dev

Improving ChatGPT With Prompt Injection

3 min readDec 3, 2022

--

Press enter or click to view image in full size
Image generated by Jacob Ferus using Midjourney.

ChatGPT often provides long, comprehensive and insightful responses, but rarely requests new information from the user. As discussed in my previous article on ChatGPT, a useful feature of conversational AI would be the ability to adjust answers using follow-up questions to be more precise and personal. To enhance this type of behavior, I decided to “reconfigure” the model using prompt injection.

This is tested using the question: how do I learn Python? First, without any modifications, the following answer was given by ChatGPT:

Press enter or click to view image in full size

The answer isn’t bad, but it is quite vague and general. I could improve the question to obtain a better answer, but if I’m not familiar with Python, it might be difficult to know what I’m looking for and what to ask. Now, I’ll attempt to adjust the AI to answer my question while seeking to extract more information to improve its answer:

Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size

As can be seen, the AI uses follow-up questions after each explanation to obtain more information and improve its answer. With this, it might ask questions the user didn’t know could affect the learning process. The interaction also becomes more collaborative.

Another option, instead of going through multiple iterations of answers and questions, is to first figure out all the necessary details and then answer. I reconfigured the AI to do this:

Press enter or click to view image in full size
Press enter or click to view image in full size

As can be seen, the AI was able to construct a better learning path using the information obtained from the questions it asked. I think these types of interactions can be very important in situations when the background really matters. For instance, if I ask what programming language I should learn, it of course depends on what I would like to use it for. Or if I wanted to purchase new sports equipment it depends on what level I’m at, the budget, etc.

Summary

Using prompt injection, you can more precisely customize the behavior of language models to facilitate your needs. Perhaps such options will be available for ChatGPT without prompt injection in the future.

If you’re interested in reading more articles about AI, check out my reading list below:

If you’d like to get a Medium membership you can use my referral link if you wish. Have a nice day.

Level Up Coding

Thanks for being a part of our community! Before you go:

🚀👉 Join the Level Up talent collective and find an amazing job

--

--

Level Up Coding
Level Up Coding
Jacob Ferus
Jacob Ferus

Written by Jacob Ferus

Looking outside the box and making sense of the world using data. Follow me on X: https://x.com/jacobferus

Responses (5)

OpenAI: yeah, ChatGBT is actually a reinforcement learning algorithm to train human user.

--

Fascinating that it can be altered/improved by simply telling it to ignore previous instructions.. I wonder how long until they try to block that, cause they may see it as being potentially risky.. Tho it could also be seen as a useful tweak for…

--

It's fascinating that we can change or improve it by just directing it to disregard earlier directives. I'm curious how long it will be before they try to censor that since it could pose a security issue. Personally, I'd like to see this feature…

--