-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the hoboLocalLLM wiki. This repository contains a fully local, privacy-focused AI chatbot pipeline and an advanced Retrieval-Augmented Generation (RAG) system. No data leaves your machine, no API keys are required, and the entire stack runs offline on your own hardware.
The project consists of two primary subsystems working in tandem:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β React/Vite Frontend β
β (Modern Dark Mode Dashboard) β
ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ
β (API Requests / SSE Stream)
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FastAPI Backend β
β (Orchestrates LangChain Pipeline) β
ββββββββββββββββ¬ββββββββββββββββββββββββββββ¬ββββββββββββββ
β β
βΌ βΌ
ββββββββββββββββββββββββββββ βββββββββββββββββββββββββββ
β Local Qdrant Database β β Local LLM Host β
β (Dense + Sparse Index) β β (llama.cpp/llama-server)β
ββββββββββββββββββββββββββββ βββββββββββββββββββββββββββ
-
LocalLLM Subsystem: Manages the local inference engine (
llama.cpp) to host GGUF models on an OpenAI-compatible endpoint. - LocalRAG Subsystem: A LangChain-powered document ingestion and retrieval application featuring Hybrid Search, Contextual Reranking (FlashRank), and a React settings dashboard.
To maximize response accuracy and limit hallucinations, the RAG pipeline implements advanced search techniques:
- Hybrid Search: Combines Dense Vector Search (using SentenceTransformers for conceptual meaning) and Sparse Vector Search (using FastEmbed's SPLADE/BM25 for exact keyword matching). Points are merged using Reciprocal Rank Fusion (RRF).
-
FlashRank Reranking: Base candidates retrieved from the database are passed through a local Cross-Encoder model (
ms-marco-MiniLM-L-12-v2) to re-score and sort them, ensuring only the most relevant contexts are fed to the LLM. -
Negative Control Guardrails: Built-in prompt rules instruct the LLM to refuse queries with a strict
"I do not have enough information to answer this question."response if the retrieved context is irrelevant.
Ensure you have Node.js (v18+) and Miniconda/Anaconda installed.
Installs llama.cpp and configures the LocalLLM Conda environment:
cd LocalLLM
.\install.ps1Installs Python packages (langchain, fastembed, flashrank, fastapi, etc.) and Node modules:
cd LocalRAG
.\install.ps1- Download any
.ggufmodel from HuggingFace (e.g. Qwen2.5, Llama 3.2, Phi-4) and place it in a local directory (e.g.,C:\LLMModels\). - Open
LocalLLM/startLocalLLM.ps1, update the model path parameter (-m), and run the script:cd LocalLLM .\startLocalLLM.ps1
This exposes the OpenAI-compatible API on http://localhost:8080.
Run the orchestrator script to launch the FastAPI backend (port 8000) and the Vite frontend (port 5173):
cd LocalRAG
.\start_rag.ps1Your default browser will automatically open to http://localhost:5173.
You can evaluate the latency, generation speed, and response accuracy of different GGUF models on your specific hardware.
To run the offline benchmark suite:
conda activate LocalLLM
cd LocalRAG/backend
python benchmark_models.py- Time to First Token (TTFT): Measures prompt processing latency.
- Throughput (Tokens/Sec): Measures text generation speed.
- Factual Recall: Verifies if the LLM correctly extracts details from ingested texts.
- Refusal Reliability: Verifies if the model correctly refuses to answer off-context questions instead of hallucinating.
You can customize parameters directly from the RAG Config tab in the web UI. Changes are written to config.yaml and hot-reloaded instantly:
| Parameter | Recommended Value | Description |
|---|---|---|
| Chunk Size | 500 - 1000 |
Target character size of text chunks. |
| Chunk Overlap | 10% of Chunk Size |
Maintained boundaries between chunks. |
| Enable Hybrid Search | True |
Combines Dense + Sparse retrievers. |
| Enable FlashRank Reranker | True |
Re-orders contexts using Cross-Encoder. |
| Base Retrieve Limit | 10 - 15 |
Chunks retrieved before reranking. |
| Rerank Limit (Top K) | 3 - 5 |
Final count of chunks passed to the LLM. |
| Temperature | 0.1 |
Low temperature ensures factual answers. |