Please suggest some good self-hostable RAG for my LLM.
from Maroon@lemmy.world to selfhosted@lemmy.world on 04 Oct 2024 19:54
https://lemmy.world/post/20507085

A while ago, I had requested help with using LLMs to manage all my teaching notes. I have since installed Ollama and been playing with it to get a feel for the setup.

I was also suggested the use of RAG (Retrieval Augmented Generation ) and CA (cognitive architecture). However, I am unclear on good self hosted options for these two tasks. Could you please suggest a few?

For example, I tried ragflow.io and installed it on my system, but it seems I need to setup an account with a username and password to use it. It remains unclear if I can use the system offline like the base ollama model, and that information won’t be sent from my computer system.

#selfhosted

threaded - newest

chagall@lemmy.world on 04 Oct 2024 20:15 next collapse

You should ask @brucethemoose@lemmy.world. He seems to know all about this stuff.

brucethemoose@lemmy.world on 04 Oct 2024 22:27 collapse

<img alt="" src="https://lemmy.world/pictrs/image/7ebcb268-642a-44e9-ab47-4bcb1e4d0e7f.mp4">

I have an old Lenovo laptop with an NVIDIA graphics card.

@Maroon@lemmy.world The biggest question I have for you is what graphics card, but generally speaking this is… less than ideal.

To answer your question, Open Web UI is the new hotness: github.com/open-webui/open-webui

I personally use exui for a lot of my LLM work, but that’s because I’m an uber minimalist.

And on your setup, I would host the best model you can on kobold.cpp or the built-in llama.cpp server (just not Ollama) and use Open Web UI as your front end. You can also use llama.cpp to host an embeddings model for RAG, if you wish.

This is a general ranking of the “best” models for document answering and summarization: huggingface.co/…/Hallucination-evaluation-leaderb…

…But generally, I prefer to not mess with RAG retrieval and just slap the context I want into the LLM myself, and for this, the performance of your machine is kind of critical (depending on just how much “context” you want it to cover). I know this is !selfhosted, but once you get your setup dialed in, you may consider making calls to an API like Groq, Cerebras or whatever, or even renting a Runpod GPU instance if that’s in your time/money budget.

kwa@lemmy.zip on 05 Oct 2024 04:22 collapse

I’m new to this and I was wondering why you don’t recommend ollama? This is the first one I managed to run and it seemed decent but if there are better alternatives I’m interested

Edit: it seems the two others don’t have an API. What would you recommend if you need an API?

brucethemoose@lemmy.world on 05 Oct 2024 05:37 collapse

Pretty much everything has an API :P

ollama is OK because its easy and automated, but you can get higher performance, better vram efficiency, and better samplers from either kobold.cpp or tabbyAPI, with the catch being that more manual configuration is required. But this is good, as it “forces” you to pick and test an optimal config for your system.

I’d recommend kobold.cpp for very short context (like 6K or less) or if you need to partially offload the model to CPU because your GPU is relatively low VRAM. Use a good IQ quantization (like IQ4_M, for instance).

Otherwise use TabbyAPI with an exl2 quantization, as it’s generally faster (but GPU only) and much better at long context through its great k/v cache quantization.

They all have OpenAI APIs, though kobold.cpp also has its own web ui.

scrubbles@poptalk.scrubbles.tech on 04 Oct 2024 20:21 next collapse

I’m not 100% what you’re asking for, but I use text-generation-webui for all of my local generation needs.

github.com/oobabooga/text-generation-webui

brucethemoose@lemmy.world on 04 Oct 2024 22:33 collapse

Text-generation-webui is cool, but also kinda crufty. Honestly a lot of the stuff is holdovers from what’s now ancient history in LLM land, and it has (for me) major performance issues at longer context.

scrubbles@poptalk.scrubbles.tech on 04 Oct 2024 23:07 collapse

Anything better you know of? Most of my usage now with it is through its api

brucethemoose@lemmy.world on 04 Oct 2024 23:11 collapse

Uh, depends on your hardware and model, but probably TabbyAPI?

scrubbles@poptalk.scrubbles.tech on 05 Oct 2024 04:43 collapse

Neat! I’ll check it out!

exu@feditown.com on 04 Oct 2024 21:03 next collapse

I’m aware of these options to do RAG, though I’m not using any yet. Only SillyTavern for chat stuff

BitSound@lemmy.world on 04 Oct 2024 23:18 next collapse

Not sure how ollama integration works in general, but these are two good libraries for RAG:

github.com/facebookresearch/faiss

pypi.org/project/chromadb/

filister@lemmy.world on 05 Oct 2024 03:48 next collapse

Why don’t you build your own?

Zelyios@lemmy.world on 05 Oct 2024 07:27 next collapse

You can use h2ogpt which allows you to build a RAG choosing your documents without coding anything

Antiochus@lemmy.one on 05 Oct 2024 14:22 next collapse

I’m not sure how well it would work in a self-hosted or server-type context, but GPT4all has built in RAG functionality. There’s also a flatpak in addition to the Windows, Mac and .deb installs.

BaroqueInMind@lemmy.one on 05 Oct 2024 15:14 collapse

Why not use this and select whatever LLM to leverage as a RAG? It literally allows you to self host the model and select any model for both chat and RAG analysis. I have it set to Hermes3 8B for chat and a 1.3B Llama3 as the RAG.