Build Your Own Private AI Assistant at Home: Ollama, RAG and a Homelab GPU

cheashawn

Cloud chat tools are useful, but they send your notes, code and client drafts to someone else's servers. If you already run a homelab, you can stand up a private assistant on a machine you control. It can answer from your own documents, keep working when the internet is slow, and stay in the house unless you reach it through a private network.

This is a practical path I use as a software engineer moving into AI engineering.

Why run a model at home

A local assistant is not a replacement for every cloud model. The largest hosted models still win at hard reasoning. What you gain at home is different:

  • Privacy. Drafts, family documents and internal notes stay on your disk.
  • Cost control. After the hardware, inference is electricity, not a per-token bill.
  • Offline usefulness. Once the model is downloaded, chat still works if the WAN drops.
  • A real learning loop. You will touch model files, VRAM limits, embeddings and retrieval, which is the daily work of AI engineering.


The stack is ordinary and well documented: Ollama (https://ollama.com) to run models, a browser UI for chat, a vector store for your files, and a mesh VPN so a laptop can connect without opening the box to the public internet.

A practical hardware starting point

You can start on a CPU-only machine, but replies will feel sluggish. A comfortable first box is a desktop or small tower with an NVIDIA RTX 4060 Ti 8 GB, 32 GB of system RAM, a fast NVMe drive with tens of gigabytes free, and a recent NVIDIA driver stack on Linux or Windows. The same card also comes in a 16 GB version.

An 8 GB card is an honest mid-range choice. Quantized 7B and 8B chat models typically land around four to five gigabytes on disk and can run fully in VRAM. The default qwen2.5:7b weight in Ollama's library is about 4.7 GB. A 14B weight file is already around 9 GB, so it will not sit fully on an 8 GB card. If you want larger models later, more VRAM is the upgrade that actually helps.

Install Ollama

Ollama (https://ollama.com) is a local model runner with a simple CLI and an HTTP API on port 11434. Source and issues live in Ollama's GitHub repository (https://github.com/ollama/ollama).

On Linux, the documented install is a single script. On macOS and Windows, use the official installer from the Ollama site. Then pull a first model and open a terminal chat:

curl -fsSL https://ollama.com/install.sh | sh

ollama pull qwen2.5:7b

ollama run qwen2.5:7b

Leave Ollama running as a service so the API stays up for the UI and for any retrieval scripts you add later.

Pick a first model

Start small. Two solid first pulls are qwen2.5:7b and llama3:8b. The 7B Qwen2.5 build in the Ollama library (https://ollama.com/library/qwen2.5) uses a 32K context window in the default tag, and is a solid daily driver for English writing and coding help. Llama 3 8B is a good second baseline on the same prompts.

Rules of thumb: pull one model and use it for a week before adding another; on 8 GB, stay with 7B and 8B quantizations; pin a tag such as qwen2.5:7b because "latest" tags move; and read the model card for the license. Most Qwen2.5 sizes use Apache 2.0; a couple of Qwen sizes use a different license. Do not expect a 7B local model to match a frontier cloud model. Expect it to be private, fast enough, and good at work it can ground in your files.

Add a chat UI

The terminal is fine for a smoke test. For daily use, put a chat interface in front of Ollama. Open WebUI (https://docs.openwebui.com) is a self-hosted, offline-friendly UI that talks to Ollama and can ingest documents for retrieval.

The docs recommend Docker for most people. A typical pattern is Ollama on the host, Open WebUI in a container, and the container reaching Ollama at http://host.docker.internal:11434. Open the UI in a browser (port 3000 in the usual Docker mapping, or 8080 if you run it with Python). Create the first admin account immediately, and set a stable secret key so a container recreate does not log everyone out.

Keep Ollama's API off the public internet. The local API does not require a login, so binding it to the world is the same as giving strangers a free model endpoint.

Give it your own documents with RAG

A bare chat model only knows its training data. Retrieval-augmented generation, or RAG, makes a home assistant useful: you store chunks of your own files as vectors, retrieve the ones that match a question, and pass those chunks into the prompt.

Embeddings and a vector store

The loop is straightforward. Collect documents you are allowed to keep. Split them into overlapping chunks so a heading stays with the paragraph under it. Embed each chunk, and save the vectors in a database you can search by similarity. At question time, embed the question, fetch the nearest chunks, and ask the chat model to answer using only that context.

Two stores that are easy to start with: Chroma (https://www.trychroma.com), a dedicated embedding database that is friendly for local prototypes, and pgvector (https://github.com/pgvector/pgvector) if you already run PostgreSQL and want vectors next to the rest of your data. Open WebUI also has built-in document upload and retrieval, so you can try the pattern before writing any code.

A first RAG loop

Keep the first version boring. Index a folder of markdown. Ask a question you already know the answer to, and check whether the retrieved chunks are the right ones. If the answer is wrong, look at retrieval first, not at the chat model.

Show the source snippets under each answer. When the assistant cannot find support in the retrieved text, it should say so. That single rule prevents a lot of confident nonsense.

Reach it safely from outside the house

Do not port-forward 11434 or the WebUI port on your router. The safer pattern is a mesh VPN. Install Tailscale on the homelab and on your laptop, then open the WebUI at the machine's Tailscale address. You are talking to your own box over an encrypted overlay, without putting a public inbound port on the internet.

The current product documentation lives in the Tailscale docs (https://tailscale.com/docs). Use access controls so only your devices can reach the UI, and leave SSH and the Ollama port off the open internet.

If other people in the house will use the assistant, give them accounts in Open WebUI and keep a single ingress: the UI, over Tailscale, never the raw model API.

Performance tips

  • Watch ollama ps and nvidia-smi while a reply is generating. If the processor column shows CPU, the model did not fit and you will feel it.
  • Shorter context is cheaper. A 32K window is useful, but stuffing it on an 8 GB card will steal VRAM from the weights.
  • Unload models you are not using. One 7B model in memory is smoother than three fighting for the same 8 GB.
  • Keep models on NVMe, and prefer a slightly smaller model that stays in VRAM over a larger one that pages into system RAM.

For RAG, retrieve fewer, better chunks. Five tight paragraphs beat twenty noisy ones.What it actually costs

The expensive line is the GPU box, and only if you do not already own one. After that, the software in this guide is free and open. You pay for electricity and for disk.

I will not invent a monthly bill. Power draw depends on the rest of the PC, how many hours the GPU is actually generating, and your local tariff. If the box already runs around the clock as a homelab, the extra cost of evening chat is usually small. Measure wall power if you care about the number. Budget an afternoon for the first chat, and a weekend for RAG over a real folder of documents.

A Cambodia angle: privacy, connectivity and Khmer

There is a local reason this setup is interesting. A lot of useful work in Cambodia still lives in documents you would rather not paste into a foreign cloud: contracts, school notes, internal write-ups, client code. A home assistant keeps that material in the room with you, and it keeps working when the home connection is uneven, because the model is already on disk.

Language is the hard part. Qwen2.5 documents multilingual support across a listed set of languages that includes English, Chinese, Vietnamese, Thai and several others. Khmer is not in that official list. In practice, a 7B or 8B local model will usually be much stronger in English than in Khmer. You can still put Khmer files into a RAG index, but treat those answers as a test, not a finished product. For Khmer-heavy work, evaluate with real prompts rather than assume support.

Start with one box, then grow

You do not need the full architecture on day one. Install Ollama, pull qwen2.5:7b, chat in the terminal, then add Open WebUI. When that feels normal, index a folder of your own writing. Only then put Tailscale in front of it so you can ask questions from a cafe without exposing a port.

A private assistant is not magic. It is a model, a retrieval step and a network boundary you understand. That is a solid first project if you are moving into AI engineering.

#AIEngineering #LocalAI #Ollama #RAG #Homelab #SelfHosted #Cambodia #kaifinn


50 views
Add Kaifinn as a preferred source on Google