Ask HN: How do I train a custom LLM/ChatGPT on my own documents in Dec 2023?
800 pointsThere is a 5 month old thread [1] on this, but it might be already outdated.
What is the best approach for feeding custom set of documents to LLM and get non-halucinating and decent result in Dec 2023?
UPD: The question is generally about how to "teach" LLM answer questions using your set of documents (not necessarily train your own, so approaches like RAG counts)
[1] https://news.ycombinator.com/item?id=36832572
Comments (237) 63 threads
Show all comments
Showing thread 1 of 63
You still do RAG. Llamaindex is still the best option that I know of. Most of the startups that have working products are likely using llamaindex. All of the ones that say they are training on documents are actually using RAG.
Test it out. If it really and truly doesn't work, search for a script that creates question and answer pairs automatically with gpt-4. Then try using that for qLoRA. I have never heard of anyone successfully using that for a private document knowledgebase though. Only for skills like math, reasoning, Python, etc. I think the issue is that you need a LOT of data and it needs to repeat concepts or any facts you need to learn many, many times in different supporting ways.
What absolutely does not work is trying to just feed a set of documents into fine tuning. I personally have proven that dozens of times because I had a client who is determined to do it. He has been mislead.
What it will do is learn the patterns that are in those documents.
https://www.microsoft.com/en-us/research/group/dynamics-insi...
LlamaIndex is pretty good.
We originally started out building features with LangChain (loading chains from YAML sounded good—it felt like it would be easy to get non-engineers to help with prompt development) but in practice it’s just way too complicated. Nice idea, but the execution feels lacking.
It also doesn’t help that LangChain is evolving so rapidly. When we first started using it a lot of code samples on the internet couldn’t be copy/pasted because of import paths changing, and at one point we had to bump by ~60 patch versions to get a bug fix, which was painful because it broke all kinds of stuff
Disclaimer: I work at deepset
[1] https://github.com/deepset-ai/haystack
Continue this thread — 1 reply
Continue this thread — 3 replies
With regards to its efficacy, I haven’t gone to production with it yet but I was reasonably impressed.
I uploaded 100 legal case documents to Bedrock via Claude and could push it pretty hard asking about the various cases and for situations across the knowledge base.
It did feel like it broke down and got confused at a certain point of complexity of questioning, but I still think it’s already useful as a “copilot” or search engine and surely it will only improve over time.
I had tried to suggest continuous pre-training to my client but it seemed expensive and when I mentioned that he lost interest and just kept wanting me to do fine tuning.
Also to clarify, did you do the continuous pre-training or RAG? And did you compare the efficacy of one or the other or both?
I got a toy demo up and running with continuous pre-training but haven’t evaluated it unfortunately.
Retrieval-Augmented Generation for Large Language Models: A Survey
https://arxiv.org/abs/2312.10997
The photos of this post are also good for a high level look
https://twitter.com/dotey/status/1738400607336120573/photo/2
From the various posts I have seen people claim that phi-2 is a good model to start off from.
If you just want to do embeddings, there are various tutorials to use pgvector for that.
https://kagi.com/search?q=ml+rag
https://www.google.com/search?q=ml+rag
Continue this thread — 6 more replies
Continue this thread — 10 more replies