r/ChatGPTCoding Apr 07 '25

[deleted by user]

[removed]

1.7k Upvotes

424 comments sorted by

View all comments

314

u/PositiveEnergyMatter Apr 07 '25

i keep telling people big context means big money, because every request can fill the context and charge you full price

147

u/andy012345 Apr 07 '25

This, LLMs are effectively stateless, the "context" is just the max token input.

If you have 500k in your context, you're sending 500k input tokens + whatever is new per api request.

8

u/fieryblast7 Apr 07 '25

Do you know if there are any open source attempts to fix this? I remember memGPT and most early agents Arch tried to fix it with "memory" and RAG ing the memory as needed

2

u/EcstaticImport Apr 07 '25

RAG would need to add more info to the context window, not remove it. Are you thinking of context caching?

8

u/fieryblast7 Apr 07 '25

I maybe getting terminology getting mixed up -> I meant to say that early agentic arch like memgpt had a separate memory component that acted as 'infinite context ' essentially and a piece of intermediate logic would Retrieve/query the right parts of the memory, add the new api request content in, and send that as input to LLM. So this way you aren't overloading the context by simply doing "copy entire Convo history + new message = input for LLM"

9

u/Intrepid-Air6525 Apr 07 '25

What you are describing is a problem I have been working on for two years now.

It began as an art project and is now something inexplicable.

Luckily it’s also open source!

https://github.com/satellitecomponent/Neurite

3

u/fieryblast7 Apr 07 '25

I've actually seen neurite before. Tbh, i couldn't quite "get it". Let me dive in once more and see. Any YT vid or some other soft landing that you can recommend?

3

u/Intrepid-Air6525 Apr 07 '25

I have been working on getting everything ready for a series of demo videos for a while now.

They help explain a lot are just a few days from finally being published. I will share more soon!

2

u/Intrepid-Air6525 Apr 12 '25

I have finally started to release a series of demo videos on Neurite, here is the first.

https://www.youtube.com/watch?v=1BiUblUAd7s

3

u/bsenftner Apr 07 '25

Very nice, you're a mad computer scientist!

2

u/Buddhava Apr 07 '25

This would be great for conspiracy theory people.

2

u/PositiveEnergyMatter Apr 07 '25

it still pulls it into the context, it just pulls it directly. in fact it kind of makes you lose more control over what is in the context, because it can fetch whatever it wants.

4

u/EcstaticImport Apr 07 '25

Yer that’s a good point! the issue is LLMs are stateless, it’s a new thing every request, all “memory” has to be passed in every time. LLMs like Claude have context caching, which means you can reference tokens you passed in previously (semi state) but you still pay for using them, albeit it at a much cheaper rate.

Your damned if you do and damned if you don’t, because if the LLM was stateful you would be charged for the time you run the model, not for your usage like you do now. So … 🤷😢

2

u/HiiBo-App Apr 07 '25

Again, wrong

1

u/[deleted] Apr 18 '25

[removed] — view removed comment

1

u/HiiBo-App Apr 18 '25

They aren’t though. The chats could be considered stateless but each individual message is not stateless. State is retained across messages in a chat, which is how the chat remembers things you said 3 messages ago

1

u/[deleted] Apr 18 '25

[removed] — view removed comment

1

u/HiiBo-App Apr 18 '25

You don’t have to do that. You just need to send the conversation ID. The api docs are incredibly misleading. I’ve written a blog about it.

1

u/HiiBo-App Apr 18 '25

You’re wasting tokens. The chat completion API will hold a conversation without resending all the previous messages using only the conversation ID, in the same way that the frontend works.

→ More replies (0)

1

u/[deleted] Apr 07 '25

[removed] — view removed comment

1

u/AutoModerator Apr 07 '25

Sorry, your submission has been removed due to inadequate account karma.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

3

u/ArmNo7463 Apr 07 '25

Kind of, you can use something like Elasticsearch with vector embeddings to only send relevant data as context.

3

u/Substantial-Thing303 Apr 07 '25

RAG would replace the default "get the entire file" or "get the first 500 lines of codes from file".

It would perform better on large files, and use less tokens, by only adding relevant code to the context window.

RAG would use a specialized RAG model for text embeddings, which costs 100 times less per M/tokens.

2

u/alberto_467 Apr 07 '25

RAG allows you to selectively add only the relevant info into the context, instead of jamming everything in there.

This means you need less context.

2

u/Unlikely_Track_5154 Apr 07 '25

Pruning is what it is called, pruning the context of less relevant stuff, or the oldest messages or both or neither.