I know this has been discussed before but I have some interesting information that may help you to solve this problem.
I use a software that uses the OpenAI API and I was actually trying to get the AI to add two extra spaces in order to investigate this problem.
I eventually created a prompt that did this as it has never happened to me on my computer, although some colleagues suffer from this problem.
Immediately after getting the AI to add two extra spaces, it now adds 2 spaces every single time when I start a new chat with the AI.
And I cannot get the AI to stop doing this with a prompt either saying “do not add any spaees to the end of each line” or similar
But the point is that I triggered this deviant behaviour by asking the AI to do it once, and cannot turn it off now
I’m not a programmer myself so please give any answers or ideas in layman’s language, although I could forward more technical answers to the programmer
Thanks for noticing this odd artifact of extra end-of-line spaces, although I haven’t gone out of my way to characterize it. It seem that gpt-4o models are the main culprit.
Every new API session is standalone, so you shouldn’t have any predisposition to having the spaces except by past messages you send in the same API call.
One could even alter the past assistant messages contents, cleaning them up, so when you send them back in a chat, they don’t have the spaces. That might provide some in-context training.
This is likely an artifact of training the model. It seems to cross API and ChatGPT and recent model versions, but is only affecting where you’d copy the response contents. In the past, i had spotted and provided quick feedback on a different model that would output more and even more trailing spaces when ending a response, and it seems that odd effect was corrected quickly, so there may be possibility of fixing this on existing models if one were to nail it down to reproducible examples with negative consequences.