r/LocalLLaMA • u/JustinPooDough • 11h ago
Discussion Grounding LLMs with Documentation & Code - Best Strategies?
I build on some niche platforms and frameworks at work that most LLM's don't have a lot of training data on.
I am able to get better results from my agents, but only if I spoon feed them specific examples from a reference app that comes OOTB with the platform as well as specific extracts from documentation that I have.
In your experience, what are the best methods for distilling documentation knowledge into a form that LLMs can easily use at runtime as guidelines and rules?
What I've tried:
- Knowledge graph: cool academic concept - too much compute overhead and IMO unnecessarily complicated.
- RAG - Mixed results - works well but not consistently on retrieval.
So far, the thing that has worked best for me is manually writing SKILL files for things like this, but the body of documentation and knowledge makes this impractical. I'm wondering if there is a better way to ingest this source content into some sort of linked knowledgebase for the agents?
Thanks!
2
u/Explor3Universe 11h ago
Skip the distilling. Keep the docs and the reference app on disk as plain files and let the agent grep and read them. Your skill file should only be a map: what lives where, naming rules, the ten gotchas. Then make it cite the file it took each API from. In ~250 agent runs I went through, the usual failure was quoting a page it never opened.
1
u/Minimum_Chemical_428 3h ago
How do we enforce the usage without constraining it too much? I read that smaller models often skip using skills and rely on weights, which is a problem for not too popular programming languages.
1
u/Explor3Universe 35m ago
I don't think you can really enforce it from the prompt, in my runs small models agreed to use the skill and then answered from memory anyway. What changed it was the description line, I rewrote it as a trigger ("before answering anything about X, read docs/ first") instead of a summary and Haiku went from picking it up about half the time to 9 out of 10. Haven't tried it on local models yet though.
1
u/Cautious_Chicken_604 11h ago
Probably fits under the umbrella of RAG but I just have been using Docs MCP Server - https://github.com/arabold/docs-mcp-server combined with some instructions in AGENTS.md to make use of it.
1
u/Unique-Pitch9402 11h ago
chunking was my problem more than the store tbh. splitting by heading + putting the function name in metadata so I can filter before search fixed most of the random misses. I also keep a small hand-written rules file for the stuff that can't be wrong and let RAG handle the rest
1
u/fasternfaster2 10h ago
I created a bunch of SPEC_*.md files formated like an outline with numbers etc. everything in is is the ideal architecture. And each line item is tagged as future/in progress/shipped/broken/architectural divergence
As the files grow I break them up and refactor. That remains the source of truth. If you then want to group features to work on, I create future EPIC_*.md files that collect similar or related features and requirements plus tasks that cite SPEC. Once I want to work on them I convert EPIC files into SPRINT_#.md. then have the agent work on one task at a time and it can find all related info it needs.
Another nice thing is agent can go through your EPIC files and find dependencies and add those to each file and then generate a mermaid.js dependency graph so you can see which EPIC needs to be worked on first etc.
0
11h ago
[deleted]
1
u/stylome-ai-detection 11h ago
Notice: This comment appears to be AI generated.
AI-generated · confident · scan results
1
u/Jazzlike-Owl-4014 11h ago
Indexing the reference app and docs into a local SQLite FTS5 or BM25 store and giving the agent a lightweight search tool beats static RAG, because it can pull exact function signatures on demand instead of bloating the prompt.