Month 3 Box - AI Deep Dive

Lesson 6: Running a Local LLM on the Raspberry Pi

What if your Raspberry Pi could talk like ChatGPT—without any internet? In this lesson, you’ll bring AI language capabilities directly to your Pi using a lightweight Local Large Language Model (LLM). Your device will answer questions, write poems, and even speak its responses—all completely offline.


🧠 What You’ll Learn Today:

  • What LLMs are and how they generate text
  • The pros and cons of running AI models locally vs in the cloud
  • How to install, run, and interact with a small LLM like TinyLLaMA
  • How to send prompts and receive ChatGPT-like responses from your Pi
  • (Optional) How to speak the model’s replies using text-to-speech


💡 What’s a Local LLM?

  • A stripped-down version of a language model like ChatGPT
  • Runs entirely on your Pi—no internet, no data sharing
  • Perfect for privacy-conscious projects or remote environments


⚙️ Tools You Might Use:

  • llama.cpp
  • GPT4All
  • Text Generation Web UI (if your Pi’s specs allow)
  • TinyLLaMA, a quantized model that fits within 1–2GB RAM


🔧 Installation Workflow:

(follow steps in the ReadMe.md)

  1. Download a GGUF quantized model
  2. Install dependencies: git, cmake, g++, etc.
  3. Clone the LLM repo and compile the backend
  4. Run a test prompt to verify it’s working


🧪 Hands-On Activity:

Write a simple Python script that:

  • Accepts a user prompt
  • Sends it to your local LLM
  • Displays the model’s response
  • (Bonus) Uses TTS from Lesson 5 to speak the answer and send audio to Discord/Telegram


Try fun prompts like:

  • “What’s a fun fact about space?”
  • “Explain what a variable is.”
  • “Write a haiku about Raspberry Pi.”


🛠️ Troubleshooting Tips:

  • Use a smaller model if your Pi runs out of memory
  • Shut down other applications to free up RAM
  • Make sure your Pi has proper cooling—LLM inference gets hot!


📝 Homework:

  • Successfully run a local LLM on your Pi
  • Ask it your own questions or get creative with your prompts
  • Post your favorite response in the #local-llm Discord thread

🔥 Bonus: Pipe the response into your speaker using TTS


🚀 Up Next:

Now that your Pi can think and talk, next we’ll train it to recognize custom objects with its camera—turning it into a true visual assistant.