AI/ML - Local LLMs, Vector Databases & RAG

Status: Active
Last Updated: 2026-08-26 Category: Artificial Intelligence & Machine Learning
Prerequisites: kb/basics/, kb/containers/docker-basics
Tags: ai, ml, llm, ollama, vector-db, rag, embeddings, fine-tuning, self-hosted

Summary

Run your own AI infrastructure with local LLMs (Ollama), vector databases (Qdrant/Milvus), and Retrieval Augmented Generation (RAG) systems. From simple chatbot to production AI applications, fully self-hosted and private.

๐ŸŽฏ Learning Philosophy

AI on Your Hardware:

Cloud AI APIs โ†’ Local LLMs โ†’ Your Data Stays Home
(Pay per token) (Free, private) (Full control)

This directory teaches AI/ML assuming no AI background but strong interest in running models locally. Progressive implementation from simple LLM inference through production RAG systems.

๐Ÿ“š Learning Path

Prerequisites: Docker basics, Python fundamentals
         โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  PHASE 1: LLM Fundamentals             โ”‚
โ”‚  โ”œโ”€ What are LLMs                      โ”‚
โ”‚  โ”œโ”€ Models vs APIs                     โ”‚
โ”‚  โ”œโ”€ Ollama setup (local LLMs)          โ”‚
โ”‚  โ”œโ”€ Running your first model           โ”‚
โ”‚  โ””โ”€ Model selection guide              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  PHASE 2: LLM Integration              โ”‚
โ”‚  โ”œโ”€ OpenAI-compatible API              โ”‚
โ”‚  โ”œโ”€ Python SDK usage                   โ”‚
โ”‚  โ”œโ”€ Prompt engineering basics          โ”‚
โ”‚  โ”œโ”€ Context windows and tokens         โ”‚
โ”‚  โ””โ”€ Streaming responses                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  PHASE 3: Vector Databases             โ”‚
โ”‚  โ”œโ”€ Embeddings explained               โ”‚
โ”‚  โ”œโ”€ Vector similarity search           โ”‚
โ”‚  โ”œโ”€ Qdrant setup                       โ”‚
โ”‚  โ”œโ”€ Storing and querying vectors       โ”‚
โ”‚  โ””โ”€ Semantic search                    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  PHASE 4: RAG Systems                  โ”‚
โ”‚  โ”œโ”€ What is RAG                        โ”‚
โ”‚  โ”œโ”€ Document chunking                  โ”‚
โ”‚  โ”œโ”€ Building RAG pipeline              โ”‚
โ”‚  โ”œโ”€ LangChain integration              โ”‚
โ”‚  โ””โ”€ Production RAG patterns            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  PHASE 5: Advanced & Fine-tuning       โ”‚
โ”‚  โ”œโ”€ Model quantization                 โ”‚
โ”‚  โ”œโ”€ Fine-tuning basics                 โ”‚
โ”‚  โ”œโ”€ Multi-modal models                 โ”‚
โ”‚  โ”œโ”€ Agent frameworks                   โ”‚
โ”‚  โ””โ”€ GPU optimization                   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“– Articles in This Directory

โœ… Recently Created (2026-08-26 headless-browser research session)

๐ŸŸข Phase 1: LLM Fundamentals (Start Here)

Understanding Large Language Models:

  1. llm-introduction - What are LLMs

    • How LLMs work (simplified)
    • Transformers architecture
    • Parameters and model sizes
    • Cloud vs local LLMs
    • Privacy considerations
    • Prerequisites: None
    • Time: 2 hours
    • Resources: [โ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 20% - Conceptual
  2. ollama-setup - Run LLMs locally

    • Ollama installation
    • GPU vs CPU inference
    • Downloading models
    • First inference
    • Model management
    • Prerequisites: Docker basics
    • Time: 1-2 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘] 60% - 8GB+ RAM, GPU optional
  3. model-selection-guide - Choosing the right model

    • Llama 3, Mistral, Phi-3
    • Model size trade-offs
    • Speed vs quality
    • Hardware requirements
    • Task-specific models
    • Prerequisites: Ollama running
    • Time: 2 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 30%
  4. ollama-cli-basics - Command-line usage

    • ollama run
    • ollama list, pull, rm
    • Prompt from stdin
    • Model parameters
    • System prompts
    • Prerequisites: Ollama installed
    • Time: 1-2 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 30%

๐ŸŸก Phase 2: LLM Integration (Build Applications)

  1. ollama-api - OpenAI-compatible API

    • REST API overview
    • /api/generate endpoint
    • /api/chat endpoint
    • Streaming responses
    • API authentication
    • Prerequisites: Ollama basics, HTTP
    • Time: 2-3 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 40%
  2. python-llm-integration - Python SDK

    • Ollama Python library
    • Basic chat implementation
    • Conversation memory
    • Error handling
    • Async usage
    • Prerequisites: Python basics
    • Time: 3-4 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘] 50%
  3. prompt-engineering - Crafting effective prompts

    • Prompt structure
    • System prompts
    • Few-shot learning
    • Chain-of-thought
    • Prompt templates
    • Prerequisites: LLM experience
    • Time: 3-4 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 40%
  4. context-and-tokens - Understanding limits

    • Token counting
    • Context window sizes
    • Truncation strategies
    • Sliding windows
    • Memory management
    • Prerequisites: LLM integration
    • Time: 2-3 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 40%
  5. llm-streaming - Real-time responses

    • SSE (Server-Sent Events)
    • Streaming with Python
    • WebSocket integration
    • Frontend display
    • Prerequisites: Web basics
    • Time: 2-3 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘] 50%

๐ŸŸ  Phase 3: Vector Databases (Semantic Search)

  1. embeddings-explained - Vector representations

    • What are embeddings
    • Sentence transformers
    • Semantic similarity
    • Dimensionality
    • Embedding models
    • Prerequisites: LLM basics
    • Time: 2-3 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 40%
  2. qdrant-setup - Vector database

    • Qdrant installation (Docker)
    • Collections and vectors
    • Distance metrics
    • Filtering
    • Web UI
    • Prerequisites: Docker basics
    • Time: 2-3 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘] 50% - 2GB RAM
  3. vector-storage-operations - CRUD operations

    • Inserting vectors
    • Similarity search
    • Payload filtering
    • Batch operations
    • Python SDK usage
    • Prerequisites: Qdrant running
    • Time: 3-4 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘] 60%
  4. semantic-search-basics - Finding similar content

    • Generating embeddings
    • Indexing documents
    • Search queries
    • Ranking results
    • Hybrid search
    • Prerequisites: Vector database
    • Time: 3-4 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘] 60%
  5. vector-db-alternatives - Other options

    • Milvus
    • Weaviate
    • ChromaDB
    • Pgvector (Postgres)
    • Comparison matrix
    • Prerequisites: Vector concepts
    • Time: 2 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 40%

๐Ÿ”ด Phase 4: RAG Systems (Production AI)

  1. rag-introduction - Retrieval Augmented Generation

    • What is RAG
    • Why RAG vs fine-tuning
    • RAG architecture
    • Use cases
    • Benefits and limitations
    • Prerequisites: LLM + vectors
    • Time: 2 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 30%
  2. document-chunking - Splitting documents

    • Chunking strategies
    • Chunk size optimization
    • Overlap considerations
    • Metadata extraction
    • Document loaders
    • Prerequisites: RAG concepts
    • Time: 2-3 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 40%
  3. rag-pipeline-basics - Building RAG

    • Ingestion pipeline
    • Retrieval step
    • Augmentation
    • Generation
    • End-to-end example
    • Prerequisites: LLM + vector DB
    • Time: 4-5 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘] 70%
  4. langchain-integration - RAG framework

    • LangChain overview
    • Document loaders
    • Vector stores
    • Retrieval chains
    • Chat with documents
    • Prerequisites: Python, RAG basics
    • Time: 4-5 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘] 70%
  5. rag-production-patterns - Scaling RAG

    • Caching strategies
    • Re-ranking results
    • Citation extraction
    • Multi-query RAG
    • Evaluation metrics
    • Prerequisites: RAG experience
    • Time: 4-5 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘] 80%

โšซ Phase 5: Advanced & Fine-tuning (Expert Level)

  1. model-quantization - Smaller, faster models

    • What is quantization
    • GGUF format
    • Q4, Q5, Q8 models
    • Speed vs accuracy
    • Creating quantized models
    • Prerequisites: LLM experience
    • Time: 3-4 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘] 60%
  2. fine-tuning-basics - Custom models

    • When to fine-tune
    • LoRA adapters
    • Dataset preparation
    • Training process
    • Evaluation
    • Prerequisites: ML basics, GPU
    • Time: 6-8 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘] 90% - 16GB+ VRAM
  3. multi-modal-models - Vision + Language

    • LLaVA (vision models)
    • Image understanding
    • OCR with LLMs
    • Audio models
    • Prerequisites: LLM proficiency
    • Time: 3-4 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘] 80%
  4. agent-frameworks - Autonomous AI

    • What are agents
    • Tool use
    • ReAct pattern
    • LangGraph
    • Multi-agent systems
    • Prerequisites: Advanced LLM usage
    • Time: 5-6 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘] 80%
  5. gpu-optimization - Hardware acceleration

    • CUDA setup
    • VRAM management
    • Batch processing
    • Model parallelism
    • Inference optimization
    • Prerequisites: GPU hardware
    • Time: 4-5 hours
    • Resources: [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘] 90%

๐Ÿ”— What Comes Next?

After mastering local AI:

For Applications:

For Infrastructure:

For Observability:

For Security:

๐Ÿ“Š Resource Requirements

Ollama (CPU):

Ollama (GPU):

Vector Databases:

RAG System (Ollama + Vector DB + App):

Learning Time Investment:

๐Ÿ› ๏ธ Recommended Tool Stack

LLM Inference:

Vector Databases:

RAG Frameworks:

Embeddings:

Supporting Tools:

๐Ÿ’ก Pro Tips for Local AI

  1. Start with Ollama: Easiest way to run local LLMs
  2. GPU is Optional: CPU works, just slower
  3. 7B Models Sweet Spot: Good balance of speed/quality
  4. RAG > Fine-tuning: For most use cases
  5. Chunk Size Matters: 500-1000 tokens usually optimal
  6. Test Multiple Models: Different models for different tasks
  7. Quantization is Your Friend: Q4 models are fast
  8. Monitor VRAM: Easy to run out of memory
  9. Streaming is Better UX: Show results as they generate
  10. Embeddings are Cheap: Cache them aggressively

๐Ÿ”„ Common AI/ML Pitfalls

Pitfall 1: Running Huge Models

Pitfall 2: Ignoring Context Limits

Pitfall 3: No Evaluation

Pitfall 4: Over-engineering

Pitfall 5: Poor Chunking

Pitfall 6: Ignoring Latency

Pitfall 7: No Prompt Versioning

Pitfall 8: Trusting Outputs Blindly

๐Ÿ”— Related KB Sections

๐Ÿ“ Change Log

2026-01-30


๐Ÿค– Remember: You don't need cloud APIs to run AI! Ollama makes local LLMs dead simple. Start with a 7B model, add RAG with Qdrant for your documents, and build AI apps that keep your data private. GPU optional - CPU works fine for many use cases!

Change Log

Choose Theme

Your selection is saved locally.

Neural Cacophony
Aperture v2
Flux v1
Mosaic Chaos
Nexus v1
Nexus Zest
Prism v2
Synapse