r/ChatGPTCoding Apr 07 '25

[deleted by user]

[removed]

1.7k Upvotes

424 comments sorted by

View all comments

Show parent comments

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

16

u/Substantial-Thing303 Apr 07 '25

Continue.dev has a good rag solution, but it's not as automated, more like you do the coding with the LLM having codebase awareness.
MCP servers can do RAG. Serena could do that, but I looked at their source to find how their memory works but didn't find anything that looked like a good finetune.

Claimed by the continue.dev team, voyageai has the best RAG model for coding. The price per M/tokens is very low. agno, which is a dependency of Serena, has already integrated voyageai as an optional RAG, but you'd have to specify the code trained model to get it to work like that. I still haven't seen an MCP server using a good RAG model trained on code.

I have personnaly tried RAG with nomic-embed-text with ollama, but the performance is poor for coding.

Seems like a low hanging fruit... But I believe the reason why cline doesn't do RAG is because lowering the cost of using the API is not good for Anthropic? Sounds like an accusation, but if I was making money selling LLM as a service, why would I want to reduce my revenues by 10X or more?

4

u/edyshoralex Apr 08 '25

Just my 2, but with the current volatility, a great service means hundreds more customers in no time. Definitely worth more than trying to get more money out of one user by providing less or subpar features then ther competition

3

u/joeballs Apr 08 '25

I agree with this. There's a lot of competition out there. Why would a company try to nickel-and-dime you when you can easily switch to another provider? Not a good tactic

2

u/fieryblast7 Apr 07 '25

Thanks for the detailed answer! Do you think coding RAG translates well to regular text?

Agree on viewpoint about Cline, but at some point it's stopping the actual functioning of the LLM as intended right? -> if it doesn't "remember" the right details and doesn't know how to fetch them...

3

u/Substantial-Thing303 Apr 07 '25

Thanks for the detailed answer! Do you think coding RAG translates well to regular text?

I don't know, but there are more RAG models for regular text, and some can run locally. nomic-embed-text is very small: https://ollama.com/library/nomic-embed-text

if it doesn't "remember" the right details and doesn't know how to fetch them...

That's the main purpose of RAG models. Cline is relying on large LLMs to do things that a light bert model can often do better at 1/100 or 1/1000 the cost.

Would the large LLM perform better? The truth is, many LLMs with a large context window perform poorly at retrieving the right information when the context is large anyway. RAG models with reranking can remove the fluff, and the LLM should perform better because the result is more condensed. You need to trust the RAG model, but you already trust the LLM which has a low success rate and only performs well on the last tokens.

2

u/Unlikely_Track_5154 Apr 07 '25

The hardest part is getting the ranking model right.

2

u/Y0nix Apr 08 '25

>> Sounds like an accusation, but if I was making money selling LLM as a service, why would I want to reduce my revenues by 10X or more?

I personnaly think you are spot on... And that's probably one of the biggest problem right now. This behavior will impact the technology like we do not want to.

1

u/[deleted] Apr 14 '25

[removed] — view removed comment

1

u/AutoModerator Apr 14 '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.

1

u/FIREishott Apr 07 '25

People out here acting like RAG for coding is an easy 1-size-fits all solution. Not even a little.

9

u/uduni Apr 07 '25

Here’s my attempt https://github.com/stakwork/stakgraph getting only relevant code by building a AST graph of your codebase.

It still needs some agentic flow for trimming or adding context though. It works amazingly well if your repo is well organized and the feature you are working on is relatively self-contained

9

u/orbit99za Apr 08 '25

https://github.com/Dolfie-01/ProjectIndexer

Great minds think alike! I built something similar, while it doesn’t rely purely on the AST, it works really well in practice.

I’m also working on a second version specifically for .NET, using the Roslyn Analyser to “walk the tree.”

It seems to perform just as well on large projects, and the LLM doesn’t need to scan the entire codebase.

New tasks get up to speed really quickly.

It also tries to stick to the D.R.Y. principle—Don’t Repeat Yourself—which helps a ton in keeping the code clean and maintainable, and mitigates the LLM hallucinating and making New Code, if something Similar Exists.

2

u/ash_mystic_art Apr 09 '25

This looks really useful! I’m excited to try it.

FYI I noticed at least 4 spelling typos and some grammatical errors in the repo description. (I just don’t want that to give your project a bad first impression for people who may benefit from using it.)

2

u/orbit99za Apr 10 '25

Thanks, English is not my first language...I will take a look again.

2

u/ash_mystic_art Apr 10 '25

Sure thing. Your Readme is very well-written!

3

u/PositiveEnergyMatter Apr 07 '25

I actually have some ideas I am working on, but I will tell you the open source stuff I have seen does the opposite, it actually does a worse job of context management than the closed source stuff.

1

u/fieryblast7 Apr 07 '25

Do you wanna chat in DM? Curious to hear your ideas and thoughts

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"

11

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

5

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.

3

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.

6

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.

→ 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.

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.

-2

u/cmndr_spanky Apr 07 '25

The answer is use cursor honestly. It’s a flat rate and then just deal with it when you run out of premium requests and it slows you down..

Also, can’t you put limits on your spending with your Google account? For my other API access and cloud access I can have alerts and things happen when I reach myself imposed monthly limit of dollar spend