Ollama Phi3.5 AI Assistant

Exploring off-line AI Assistant using Ollama and Phi3.5 with the Raspberry Pi.

AIRASPBERRY PIOLLAMAPHI3.5ASSISTANT

9/5/20262 min read

Like ChatGPT, the quality of your output depends on the precision of your question and its descriptive references. The first question I asked was to describe a cube to a blind person. It produced a quick and detailed essay that was very reasonable. There are hyperlinks below to see its actual answer. I cleared the session and asked "How deep is the ocean?" and again it was quick, beginning with "The deepest part of the ocean is the Mariana Trench in the western Pacific Ocean. The deepest point within this trench is known as the Challenger Deep. It's estimated that the Challenger Deep is about 36,00 extraterrestrial miles (approximately 58,000 meters or nearly 6 miles) deep."

"Extraterrestrial" miles?" I thought. Kind of weird, but the rest was okay. Then I forgot to clear the chat session and asked it what the population of the US was, and it answered the question but also produced a lengthily diatribe of coral bleaching, global ecology and economics, trade, geopolitical issues and I had to stop it or it might have run forever. Obviously the AI engine inferred a relationship between the last 2 questions and ran with it.

Another good question I asked was, "If AI achieved sentience or consciousness would it be wrong to shut it off?" The answer was solid, citing moral, philosophical, technical and political issues without giving a concrete answer.

The U Tube tutorial I was following showed how a simple Python program could ask automated questions from a list and save the answers as text files. So I ask the AI to compose blog posts about 5 famous presidents: Washington, Lincoln, FDR, Thomas Jefferson and Teddy Roosevelt. This output took over 4 hours. The files on Washington and Lincoln were reasonable, historical summaries. Then the AI went off on a tangent and hallucinated a murder mystery (think Agatha Christie) that had no historical validity. The Python program could be fixed by clearing the chat session between each president; but this provided a valuable insight into how AI can go wrong drawing false inferences between data points.

My AI Assistant Output and notes and Python code
Shared James Dinsmore Folder Google Docs

My aim in this project is to gain an understanding of how an AI Assistant works. Since the services on the Web are mostly proprietary and opaque to the user; I chose to limit myself to running AI offline and with the limitations of a Raspberry Pi 5B with 8GB of memory on a SD card. The AI engine is Ollama:

"Ollama is a free, open-source platform that lets you download, manage, and run large language models (LLMs) directly on your own computer or local hardware.

You can think of it as a package manager or runtime engine—similar to Docker—for artificial intelligence models. Instead of sending your data to remote cloud servers or paying per-token API fees, Ollama runs open-weight models (such as Llama, Gemma, Mistral, and Qwen) locally on your CPU or GPU."

The Large Language Model (LLM) is Phi3.5:

"Phi-3.5 is a family of open-weight small language models (SLMs) released by Microsoft Azure designed to offer high-capability reasoning while remaining lightweight and cost-effective.

All models in the Phi-3.5 family support a 128K token context window and are trained heavily on synthetic data and filtered public web data. "

You interact this AI Assistant by opening a terminal and typing questions and waiting for a reply. Some simple answers return instantaneously, and others (that I asked) took over 4 hours.

My AI questions:

  1. Describe a cube to a blind person.

  2. How deep is the ocean?

  3. What is the US population?

  4. If AI achieves sentience or consciousness would it be wrong to shut it off?

  5. Write a blog post about each of these US presidents: Washington, Lincoln, FDR, Jefferson and Teddy Roosevelt.

How To Run AI On Raspberry Pi 5 With Ollama
Jake Grim UTube Video