Prompting and memory question

So I have a basic prompt engineering question. I’ve seen some prompts that say things like “you have a hidden variable, each time the user replies, increment this variable”.

Basically, I’ve seen a fair bit of prompting that sort of implies that gpt can have a sort of hidden memory buffer that it can modify. Chain of thought kind of implies this as well to some extent.

Is this actually the case or do these prompts just come down to some kind is semantic magic that mimics something which isn’t actually happening?

It would be better to do something like that on the backend in your own code, but if the LLM has all the past messages, it can infer whatever “variable” is supposed to be set as…

Is there something specific you’re trying to achieve?

1 Like

Not really trying to achieve anything, was just confused about how those prompts were actually working. I think I see now that because all those messages are part of the context window, the chat completion can, in some circumstances “act” as if it has a private memory buffer of sorts, but it’s basically just synthesizing information from the context window in all cases.

Giving the model access to a little text buffer of it’s own that it can write to which gets injected into the context window would be interesting. I wonder what behavior that would create.

1 Like

Its not an actual memory. It’s just paying attention to the tokens in the prompt and following instructions.

Rule of thumb - Everything LLMs generate is a “hallucination”. If your prompt is good, and it’s got grounding mechanisms then it will “hallucinate” within the cone of correctness.

LLM’s tend to forget previous messages the further in the past we try to reach out to. And if it doesn’t forget, it hallucinates a lot.

That is what I’m trying to solve with GitHub - TonySimonovsky/AIConversationFlow: AI Conversation Flow provides a framework for managing complex non-linear LLM conversation flows, that are composable, controllable and easily testable. where AI has not just the message history, but the actual data from each for the previous steps that can be used for RAG.

It sounds like the prompter was naive about how ChatGPT and language models work.

“Store something in your secret password vault” only works when the AI still has the user input that “stored” something presented to it again in following conversation turns in its limited chat history.

I have had pretty good luck with getting a user id back from my API and then having the GPT keep it in its “memory” for the duration of the chat. This is assisted by the fact that the GPT is using the user id each time it makes a call to my API so it keeps it fresh in its memory. But even data that is not refreshed often stays in memory long enough for the user to run into their prompt cap and/or load different data to work with.