Home / Insights

Your Own Private AI Assistant: Building a Local LLM with AnythingLLM and Ollama

Contents
  1. What you are building
  2. "Training" the model: what actually happens
  3. Step 1: Install Ollama and pull two models
  4. Step 2: Install AnythingLLM and choose the AI provider
  5. Step 3: The embedding model and its maximum chunk length
  6. Step 4: The vector database
  7. Step 5: Text splitting and chunking
  8. Step 6: Create a workspace and tune retrieval
  9. Step 7: Agent skills
  10. Accuracy: testing and fixing answers
  11. Security: what stays private, and what you must still do
  12. The checklist

A private AI assistant that answers questions from your own documents no longer needs a cloud subscription or a data-sharing agreement. A recent desktop PC with a mid-range graphics card can run a capable open model, read your procedures, reports and contracts, and answer with citations, without a byte leaving the building.

This guide builds one on a single Windows PC with two free tools: Ollama, which runs the models, and AnythingLLM Desktop, which handles the documents, the chat and the agents. It covers each setting that decides how well the assistant works: the AI provider, the embedding model, the maximum embedding chunk length, the vector database, the text splitter, agent skills, and finally accuracy and security.

Written against AnythingLLM Desktop v1.19 and Ollama 0.40 in November 2026. Menu names move between releases; the settings themselves have been stable.

What you are building

AnythingLLM is the front end. It stores your documents, splits them into chunks, keeps their vectors in a built-in database and runs the chat. It does not run the model itself in this setup: it sends requests to Ollama on the same PC, which loads the models onto the graphics card.

Your Windows PC: nothing below this line needs the internetAnythingLLM Desktop (the front end)Workspacesand chatDocumentcollectorText splitter(chunking)Agent andskillsLanceDB vector database(built in, files on disk)Storage folder: documents, vectors, chats, settingsOllama (the model runner)http://127.0.0.1:11434Chat modelgemma4:12b on the RTX 5070Embedding modelembeddinggemmaGPU: 12 GB VRAMOptional and off by default here: cloud LLMs, web browsing, MCP servers, telemetry
Figure 1. The whole system on one PC. AnythingLLM talks to Ollama over the local address 127.0.0.1, so no traffic leaves the machine.

The example PC throughout is a Windows 11 desktop with an Intel Core Ultra 7, 32 GB of RAM and an NVIDIA RTX 5070 with 12 GB of video memory (VRAM). VRAM is the number that matters most: the model has to fit in it to run at full speed.

ComponentChoice in this guideWhy
Model runnerOllamaFree, one-line model downloads, uses the GPU automatically
Chat modelgemma4:12bFits in 12 GB of VRAM and runs fully on the GPU
Embedding modelembeddinggemmaSmall (about 300M parameters), multilingual, 2,048-token input
Front endAnythingLLM DesktopDocuments, chat, agents and settings in one installer
Vector databaseLanceDB (built in)No setup; vectors stay in AnythingLLM's own folder
Text splitter1,000 characters, 20 overlapThe defaults, and a sound starting point

"Training" the model: what actually happens

People ask how to train their local model on their documents. In almost every case the answer is: you do not. AnythingLLM uses retrieval-augmented generation (RAG). The model's weights never change. Instead, for each question the most relevant passages of your documents are found and placed in front of the model, which writes its answer from them.

ApproachWhat changesEffortUse it for
RAG (AnythingLLM workspaces)Nothing in the model; your documents are searched at question timeMinutesFacts that live in documents and change over time
System promptThe standing instructions for one workspaceMinutesTone, format, role, rules such as "cite the section number"
Fine-tuningThe model's weights, using hundreds of example question-and-answer pairsDays, outside AnythingLLMA house style or a narrow task the model keeps getting wrong

Start with RAG and a good system prompt. Fine-tune only when you can show, with examples, a failure that better retrieval and instructions cannot fix. A fine-tuned model can be loaded into Ollama and selected in AnythingLLM like any other.

A. Once per document: ingestionUploadPDF, Word,web pageParseto plain textSplitinto chunksEmbedeach chunkStorevectors inLanceDBB. Every question: retrieval and answerQuestionEmbed thequestionFind thenearest chunksBuild thepromptLLM writesthe answersame databaseTop 4 chunks abovethe similarity thresholdSystem prompt, chunks,history and questionwith citations
Figure 2. The two halves of RAG. Ingestion runs once for each document; retrieval runs for every question, against the same database.

Step 1: Install Ollama and pull two models

Install Ollama for Windows from ollama.com. It runs in the background and listens on http://127.0.0.1:11434. Then, in a terminal, download a chat model and an embedding model:

ollama pull gemma4:12b
ollama pull embeddinggemma
ollama run gemma4:12b "Reply with OK"
ollama ps

ollama ps lists the loaded models. The PROCESSOR column should read 100% GPU. If it shows a CPU share, the model plus its context window does not fit in VRAM: choose a smaller model or a shorter context, or answers will be several times slower.

VRAMChat model size that runs fully on the GPU (4-bit)Typical use
6–8 GBAbout 3 to 8 billion parametersSimple Q&A over short documents
12 GBAbout 8 to 14 billion parametersDocument Q&A, summaries, drafting; light agent use
16–24 GBAbout 14 to 32 billion parametersBetter reasoning and more reliable agent tool use

Rule of thumb only: a 4-bit model needs roughly 0.6 GB per billion parameters, plus room for the context window.

Step 2: Install AnythingLLM and choose the AI provider

Download AnythingLLM Desktop from anythingllm.com and run the installer. No account is needed. The first-run wizard asks for an LLM provider; you can change every choice later under Settings > AI Providers.

AnythingLLM can call many providers. The choice decides where your questions and document snippets are sent.

ProviderRuns whereData leaves the PC?Best for
OllamaYour PCNoPrivate use with a GPU; the choice in this guide
LM StudioYour PCNoPeople who prefer a graphical model browser
AnythingLLM built-inYour PCNoTrying it out with no other software
LocalAI, KoboldCPPYour PC or a local serverNoExisting self-hosted setups
OpenAI, Anthropic, Google Gemini, MistralThe vendor's cloudYesHardest tasks; pay per token
Azure OpenAI, AWS Bedrock, Google VertexYour company's cloud accountYes, to your tenancyFirms with existing cloud agreements
OpenRouter, Groq, Together AIThe vendor's cloudYesTrying many open models quickly

Select Ollama, keep the base URL, and pick gemma4:12b. Set the context window (Max Tokens) to the size Ollama loads the model with; a mismatch either wastes the window or lets text be cut without warning.

Settings · AI Providers · LLMAI Providers· LLM· Embedder· Vector Database· Text SplitterAgent SkillsPrivacy & DataLLM PreferenceThe model that writes every answer in every workspace.OllamaRun LLMs locallyOllama Base URLhttp://127.0.0.1:11434Ollama Modelgemma4:12bMax Tokens (context window)8192Match Ollama's context lengthPerformance ModeBase (default)Maximum uses more VRAMKeep model loaded5 minutesSave
Figure 3. The LLM settings with Ollama selected. Simplified redrawing of the AnythingLLM screen; field layout differs slightly by version.

Step 3: The embedding model and its maximum chunk length

The embedding model turns text into a vector: a list of numbers that places similar meanings close together. Every chunk of every document is embedded once; every question is embedded when it is asked, and the nearest chunks are retrieved. Retrieval quality depends more on the embedder than most people expect.

Under Settings > AI Providers > Embedder, choose Ollama and select embeddinggemma. Ollama lists chat and embedding models in the same dropdown, so make sure you pick the embedder.

Settings · AI Providers · EmbedderAI Providers· LLM· Embedder· Vector Database· Text SplitterAgent SkillsPrivacy & DataEmbedder PreferenceTurns each chunk, and each question, into a vector. Changing it means re-embedding.OllamaEmbeddings from OllamaAnythingLLM EmbedderBuilt in, runs on the CPUOllama Base URLhttp://127.0.0.1:11434Embedding Modelembeddinggemma:latestMax Embedding Chunk Length8192The embedder's input limit, in charactersDo not pick a chat model here: Ollama lists both kinds in the same dropdown.Save
Figure 4. The embedder settings. Simplified redrawing of the AnythingLLM screen.

Max Embedding Chunk Length tells AnythingLLM the largest piece of text, in characters, that the embedding model accepts. It is a ceiling, not the chunk size. If the text splitter's chunk size is set above it, AnythingLLM quietly uses this limit instead and logs a warning. Set it from the model's token limit at about four characters per token: embeddinggemma reads 2,048 tokens, or roughly 8,000 characters of English. With 1,000-character chunks you are far below it either way.

Embedding modelRuns onInput limitVector sizeNotes
AnythingLLM built-inCPUShort384Zero setup; adequate for small libraries
embeddinggemmaOllama2,048 tokens768Small, fast, over 100 languages
nomic-embed-textOllama8,192 tokens768Popular English default
mxbai-embed-largeOllama512 tokens1,024Strong retrieval; keep chunks short
bge-m3Ollama8,192 tokens1,024Multilingual, long inputs

Changing the embedding model makes every stored vector meaningless, because the old and new models place text in different spaces. Pick the embedder before you load your library, and re-embed everything if you change it.

Step 4: The vector database

The vector database stores each chunk's vector next to its original text and finds the nearest ones to a question. AnythingLLM ships with LanceDB built in. It needs no configuration, keeps its files inside AnythingLLM's storage folder, and handles libraries of many thousands of documents on one PC.

OptionWhere it runsWhen to choose it
LanceDB (default)Inside AnythingLLMSingle PC, private use. The right choice for this guide
Chroma, MilvusA local server you runSeveral apps sharing one vector store
Pinecone, Qdrant, Weaviate, Zilliz, AstraDB, Chroma CloudVendor cloudTeam servers at scale; your text is stored with the vendor

Like the embedder, a change of vector database starts with an empty store, and every document has to be embedded again.

Step 5: Text splitting and chunking

Before a document is embedded it is cut into chunks. Each chunk becomes one vector, and chunks, not whole documents, are what the model sees when it answers. AnythingLLM uses a recursive splitter: it tries to cut at a paragraph break, then at a line break, then at a space, and splits a word only as a last resort. Two settings control it, under Settings > AI Providers > Text Splitter & Chunking.

  • Text Chunk Size: the maximum length of a chunk, in characters (not tokens). The default is 1,000, about 250 tokens.
  • Text Chunk Overlap: how many characters each chunk repeats from the end of the one before. The default is 20.
Source paragraph (about 230 characters)The feed pump P-101 trips on low suction pressure. Before restarting, check the tank level and the strainer. If the strainer is blocked, isolate the pump, drain the casing and clean the basket. Record the event in the log.Chunk 1Chunk 2Chunk 3overlapoverlapThe splitter cuts at a paragraph break if it can, then a line break, then a space. The overlap repeats the end of one chunkat the start of the next, so a sentence cut in half still appears whole in one of them.
Figure 5. How overlap protects a sentence that falls on a chunk boundary.
Settings · AI Providers · Text Splitter and Vector DatabaseAI Providers· LLM· Embedder· Vector Database· Text SplitterAgent SkillsPrivacy & DataText Splitter & ChunkingApplies to documents embedded after you save. Existing chunks are not changed.Text Chunk Size (characters)1000Embed model maximum length is 8192Text Chunk Overlap (characters)20Must be smaller than the chunk sizeVector DatabaseLanceDB100% local, no setupChromaLocal serverMilvusLocal serverChanging the vector database means embedding every document again.Save
Figure 6. Text splitter and vector database settings. Simplified redrawing of the AnythingLLM screens.

The chunk size is a trade-off. Small chunks match precisely but may lose the sentence that gives them meaning. Large chunks keep context together but bring irrelevant text with them, and fewer fit in the model's context window. The table works through one example: a 100-page manual of about 300,000 characters, with four chunks retrieved per question.

Chunk size (characters)Tokens per chunkChunks in the manualTokens sent per questionSuits
500≈125625≈500FAQs, glossaries, spare-parts lists, short self-contained entries
1,000≈250307≈1,000Default. Manuals, procedures, policies, most business documents
2,000≈500152≈2,000Reports and papers where an answer needs a whole section
4,000≈1,00076≈4,000Long narrative text; check the embedder limit and context window first
Chunks for a 300,000-character manualTokens handed to the LLM per question500 characters625≈5001,000 characters307≈1,0002,000 characters152≈2,0004,000 characters76≈4,000Darker bars: the 1,000-character default. Four snippets per question, about four characters per token.
Figure 7. Smaller chunks mean more vectors to search; larger chunks mean more text in every prompt.

Three practical points. Change one setting at a time and test with the same questions. New settings apply only to documents embedded afterwards, so remove and re-add documents to compare. And raise the overlap to 10% to 20% of the chunk size (100 to 200 characters at the default) for procedures and contracts, where one sentence often depends on the one before it.

Clean input matters as much as the numbers. Scanned PDFs without a text layer, multi-column layouts, and tables flattened into a stream of numbers all produce poor chunks. Converting important documents to clean text or Markdown before uploading usually helps more than any slider.

Step 6: Create a workspace and tune retrieval

A workspace is a separate assistant with its own documents, system prompt and settings. The model can only see documents embedded in that workspace. Create one per subject (for example "Plant procedures" and "Client contracts") rather than one for everything; a smaller pool of chunks gives cleaner matches.

Drag documents into the workspace and choose Move to Workspace to embed them. Then open the workspace settings:

Workspace settingWhat it doesSuggested start
Chat modeChat mixes your documents with the model's general knowledge; Query answers only from documents and says so when nothing relevant is foundQuery, for document Q&A
System promptStanding instructions for every answerRole, sources only, cite the document and section
Max context snippetsHow many chunks are retrieved per question4 to 6
Document similarity thresholdDrops chunks that match too weaklyLow; raise it if answers drift off topic
Search preferenceAccuracy-optimized adds a re-ranking step after the searchAccuracy-optimized
LLM temperatureRandomness of the wording0.1 to 0.3 for factual answers

Two more tools help. Pinning a document sends its full text with every question instead of a few chunks, which suits one short, critical document if it fits the context window. Attaching a file to a single chat does the same for a one-off question without adding it to the library.

An 8,192-token context window, filled for one question (illustrative)1,0003,0003,692System prompt: 400 tokens4 document chunks: 1,000 tokensChat history: 3,000 tokensQuestion: 100 tokensRoom for the answer: 3,692 tokensIf the window is smaller than the model was loaded with, or the chat runs long, the oldest text is cut first.
Figure 8. Everything sent to the model shares one context window. Long chats crowd out document chunks first.

Step 7: Agent skills

A normal chat only answers. An agent can act: search the documents again, summarize a whole file, browse the web, save a file, query a database or call another program. Start one by typing @agent in a chat. Under Settings > Agent Skills each skill has its own switch.

SkillWhat it doesFor a private document assistant
RAG searchSearches the workspace's documents on demandOn
Summarize documents, list documentsReads a whole document; lists what the workspace holdsOn
Chart generationDraws a chart from data in the chatOptional
Web browsing, web scrapingSearches and reads the internetOff, unless needed: queries leave the PC
Save files, file system agentWrites and reads files on your computerOff, or limited to one folder
SQL agentRuns queries on a connected databaseRead-only account only
Gmail, Google Calendar, OutlookReads and acts on mail and calendarsOff for a document assistant
Scheduled jobsRuns an agent task on a timetableOptional
Settings · Agent SkillsAI Providers· LLM· Embedder· Vector Database· Text SplitterAgent SkillsPrivacy & DataAgent SkillsEach switch decides what the agent may do. Use @agent in a chat to call it.RAG searchSearch the workspace's documentsSummarize documentsRead a whole document and summarize itList documentsSee what the workspace holdsWeb browsingSearch the web (DuckDuckGo by default)Web scrapingFetch and read a web pageSave filesWrite a file to your computerSQL agentQuery a database you connectFile system agentRead and write files in folders you allowShown as this article recommends for a private document assistant, not as the defaults.
Figure 9. Agent skills switched for a private document assistant. Simplified redrawing of the AnythingLLM screen.

Beyond the built-in skills, AnythingLLM can load custom skills (small JavaScript programs placed in the plugins/agent-skills folder of its storage directory), connect to MCP servers that expose other tools, and run Agent Flows, fixed step-by-step workflows built without code. Its intelligent tool selection sends only the tools relevant to each request to the model, which keeps prompts short for local models.

Agents ask more of the model than plain Q&A: it has to decide which tool to call and format the call correctly. A 12-billion-parameter model handles simple, single-tool requests well and becomes unreliable on long multi-step tasks. If the agent ignores its tools, try a model trained for tool use or a larger one before blaming the settings.

Accuracy: testing and fixing answers

Do not judge a setup on three questions. Write 20 to 30 questions whose answers you know and whose source page you can name. Run them after every change and record, for each one, whether the right chunk was retrieved (shown in the citations) and whether the answer was right. Those are two different failures with different fixes.

SymptomLikely causeFix
"I couldn't find that" when the answer is in a documentDocument not embedded in this workspace, or threshold too highCheck the workspace's document list; lower the threshold
Citations point to the wrong passagesWeak embedder, poor text extraction, chunks too largeClean the source text; try a stronger embedder; reduce chunk size
Right passage cited, wrong answerModel too small, temperature too high, context cutLower temperature; check the context window; try a larger model
Answer mixes in outside "facts"Chat mode lets the model use general knowledgeSwitch to Query mode; tell it to answer only from sources
Questions like "how many" or "list all" failRAG retrieves 4 to 6 chunks, never the whole libraryUse an agent to summarize the document, or pin it
Quality drops late in a long chatHistory crowds the context windowStart a new thread for a new topic
Changed settings made no differenceOld chunks are still in the databaseRemove and re-embed the documents

A local assistant can still be wrong, fluently. Keep a person accountable for any answer that feeds a decision, and make the assistant show its sources so that person can check them in seconds.

For a deeper treatment of retrieval design and evaluation, see the journal paper Retrieval-Augmented Generation: Design, Evaluation and Failure Analysis.

Security: what stays private, and what you must still do

With Ollama, the built-in embedder or an Ollama embedder, and LanceDB, your documents, vectors, chats and model inference all stay on the PC. That removes the largest risk of cloud AI. It does not make the setup secure by itself.

Stays on the PC with the setup in this article✓ Your documents and their parsed text✓ Chunks and vectors (LanceDB)✓ Questions, answers and chat history✓ Model weights and every inference (Ollama)✓ Settings, workspaces and system promptsProtect it like any local data:disk encryption, a Windows sign-in, backups.Can leave the PC if you turn it on! A cloud LLM or embedder! Web browsing and scraping! MCP servers and custom skills! Gmail, Calendar, Outlook skills! Anonymous telemetry! Ollama opened to the networkEach is a deliberate choice.
Figure 10. The privacy boundary. Everything on the left is local by design; everything on the right is a switch you control.
AreaAction
The PCUse a Windows sign-in and turn on device encryption or BitLocker. AnythingLLM Desktop is single-user and has no password of its own, so anyone at the unlocked PC can read every workspace.
Ollama's network portLeave it on 127.0.0.1. Do not set it to listen on all addresses unless a firewall limits who can reach it; Ollama has no login.
TelemetryAnythingLLM sends anonymous usage data by default. Turn it off under Settings > Privacy & Data if your policy requires.
Cloud switchesConfirm the LLM, embedder and vector database are all local. One cloud setting sends document text out.
Agent skillsSwitch off web, file-writing and mail skills you do not need. Treat web pages and documents as untrusted: hidden text in them can try to steer the agent (prompt injection).
Custom skills and MCP serversInstall only code you have read or trust. They run with your Windows permissions.
Deleting dataRemoving a document from a workspace keeps it in My Documents. Delete it from My Documents to erase the text and its cached vectors.
Several usersUse the Docker (server) edition instead: it adds multi-user mode with admin, manager and default roles.
Backups and updatesBack up AnythingLLM's storage folder with your other data, and keep both apps updated.

The checklist

  1. Install Ollama, pull a chat model that fits your VRAM and an embedding model, and confirm 100% GPU with ollama ps.
  2. Install AnythingLLM Desktop. Set the LLM provider to Ollama and match the context window.
  3. Set the embedder to the Ollama embedding model and its maximum chunk length to the model's limit, before loading documents.
  4. Keep LanceDB and the default chunking (1,000 characters) to start; raise the overlap for procedures.
  5. Create one workspace per subject, use Query mode, a sources-only system prompt and a low temperature.
  6. Switch on only the agent skills you need.
  7. Build a 20-question test set and rerun it after every change.
  8. Encrypt the disk, keep Ollama on localhost, review telemetry and back up the storage folder.

A private assistant like this is often the first building block of a company's own AI operating system. The journal paper AI Operating Systems: A Reference Architecture and Governance Model describes how the pieces fit together at company scale, and Score Versus Cost Per Task covers when a cloud model is worth paying for instead.

Settings screens in this article are simplified redrawings, not screenshots, and some field names vary by version. Hardware guidance is a rule of thumb; check the model's page for its actual memory use.

Keep reading

Related articles

All 151 articles

Ready to find your next improvement?

Book a strategy call. We will talk through your goals, pain points and where AI, systems or process work can make the biggest difference.