Dev.to AI 🤖 Ai 👁 0 📖 7 min read

How to Actually Use LLMs Locally

Originally published on SiliconPost I get it — you want privacy, or your favorite AI model stopped responding. You can run an AI model on your own computer or phone instead. Here’s the simple route: build llama.cpp,

How to Actually Use LLMs Locally

Originally published on SiliconPost

I get it — you want privacy, or your favorite AI model stopped responding. You can run an AI model on your own computer or phone instead. Here’s the simple route: build llama.cpp, download a model from Hugging Face, then start llama-server.

Run it on a computer

These steps work on Linux and Windows. You don’t need a graphics card; a newer computer will simply answer faster. The model file can be several gigabytes, so make sure you have enough free storage.

1. Install the build tools

On Ubuntu or Debian Linux, open Terminal and install Git, CMake, and the C++ compiler:

sudo apt update
sudo apt install -y git cmake build-essential

On Windows, install Git for Windows and CMake. You’ll also need Visual Studio 2022 with the Desktop development with C++ workload. Open a PowerShell window after installing them.

2. Get and build llama.cpp

Run these commands in Terminal on Linux or PowerShell on Windows:

git clone https://github.com/ggml-org/llama.cpp.git
cd llama.cpp
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release -j

This builds the server on your computer. It can take a few minutes. You only need to do this once; rebuild later by running the last two commands from inside the llama.cpp folder.

Make llama-server available from any folder

Add the folder containing the server to your system’s PATH. Then you can type llama-server in a new terminal from anywhere, instead of entering its full location each time.

Linux: From inside the llama.cpp folder, create a link in your personal command folder:

mkdir -p "$HOME/.local/bin"
ln -s "$PWD/build/bin/llama-server" "$HOME/.local/bin/llama-server"

If command -v llama-server prints nothing, add ~/.local/bin to PATH. Use the line for the shell you use—Bash or Zsh—then open a new terminal:

# Bash
printf '\nexport PATH="$HOME/.local/bin:$PATH"\n' >> ~/.bashrc

# Zsh: use this instead of the Bash line
printf '\nexport PATH="$HOME/.local/bin:$PATH"\n' >> ~/.zshrc

Windows: Add the folder containing llama-server.exe to your user PATH:

  1. Search Windows for Edit environment variables for your account and open it.
  2. Select Path under User variables, choose Edit, then New.
  3. Add the build folder, usually C:\path\to\llama.cpp\build\bin\Release, and save the dialogs.
  4. Open a new PowerShell window and verify it with Get-Command llama-server.

Keep the llama.cpp folder in place; on Linux, the link points to the built server inside it. If you rebuild or move the project, update the link or PATH entry.

3. Download a model

A model is a separate file. For llama.cpp, choose a GGUF file. On Hugging Face, open a model link below, choose its Q4_K_M file, and press Download. Save it somewhere easy to find, such as a models folder in your home directory. These files are large; check the listed size before downloading.

  • Very small, with tool calling: LittleLamb Tool-Calling 0.3B GGUF — choose Q4_K_M. It’s unusually small, but a model this tiny will make mistakes; treat tool calls as suggestions and check them.
  • Low-end computer: Qwen 3.5 2B GGUF — choose Q4_K_M.
  • A stronger everyday model: Qwen 3.5 4B GGUF — choose Q4_K_M.
  • Small Gemma option: Gemma 4 E2B GGUF — choose Q4_K_M.
  • DeepSeek-V4-Pro distilled to 4B: Community Qwen 3.5 4B GGUF — a community-made math-and-science-focused distillation, not the enormous original DeepSeek-V4-Pro model. Check its model card and limitations before choosing it.

Q4_K_M is the sweet spot for quality and size. Go below it and you progressively lobotomize the model: answers get weaker, and tool calls become less dependable. If memory is tight, choose a smaller model at Q4_K_M instead of squeezing a larger one into a very low quantization. Leave extra RAM free for the conversation; a model that fits on disk may still be too large to run comfortably.

4. Start the server

After adding the server to PATH, replace the example model path with the full path to your downloaded file. This command works from any folder.

Linux:

llama-server -m "$HOME/models/Qwen3.5-2B-Q4_K_M.gguf"

Windows PowerShell:

llama-server -m "C:\models\Qwen3.5-2B-Q4_K_M.gguf"

If you skipped the PATH setup, run the server using its full location instead—for example, ./build/bin/llama-server on Linux or C:\path\to\llama.cpp\build\bin\Release\llama-server.exe on Windows.

When it says the server is listening, open http://localhost:9931 in your browser. Keep the terminal window open while you chat. The llama.cpp web interface is included with the server.

Terminal showing llama-server starting a local GGUF model and listening at localhost port 9931

The server prints its local address after the model loads. Yours may take longer, especially on an older CPU.

You can also use the example names from the model list above, but make sure the path and filename match the file you actually downloaded. To use a different port, add --port 8080 and open http://localhost:8080 instead.

If something goes wrong

  • “No such file” or “cannot open model”: Check that the download finished and that the path and filename are exact. Put the path in quotes if it contains spaces.
  • The computer runs out of memory or becomes unresponsive: Try the 0.3B or 2B model, close other apps, or lower the context with -c 4096.
  • “Address already in use”: Another server is using port 9931. Stop it, or add --port 8080 and open that port in your browser.
  • Unsupported model or strange loading errors: Update llama.cpp by running git pull inside its folder, then rebuild with cmake --build build --config Release -j. Newer models need a recent build.
  • Windows says the server file is missing: Confirm you built successfully and check for build\\bin\\Release\\llama-server.exe inside the project folder.

Chat, tools, and MCP

The built-in web interface has a model page and an MCP section. MCP lets you connect compatible external tools to the local chat; it is optional, and it is separate from simply chatting with your model.

The llama.cpp web interface ready for a first chat

The local chat screen appears in your browser.

A conversation with a locally running model in the llama.cpp web interface

Choose a loaded model and start a conversation.

The llama.cpp Models page listing a locally loaded Bonsai GGUF model

The Models page shows which model the server has loaded.

The llama.cpp MCP page showing configured external tool servers

MCP servers are managed separately from the chat.

The form for adding a compatible MCP server to llama.cpp

Add a server only if you recognize and trust it.

The llama.cpp interface showing MCP server connection settings

Check the server address and any access settings before connecting.

Tool use depends on the model, the server, and the tool connection; it is not guaranteed just because the interface has an MCP page. Start with a model that says it supports tool calling. Only connect MCP servers you trust: tools may be able to access files, websites, or other services, depending on what you authorize.

Run it on a phone

Android: PocketPal

PocketPal AI on Google Play runs models on your Android phone. The screens below follow the app’s current labels:

  1. Install and open PocketPal. On the empty Chat screen, tap Select Model. You can also open the ☰ menu and tap Models.
  2. On the Models screen, tap the + button, then choose Add from Hugging Face.
  3. Search for a model, such as Qwen 3.5 0.8B, and open a result that provides GGUF files. Check the model name and file size before downloading; search results can include unrelated fine-tunes.
  4. On the model page, choose a GGUF quantization if there is a choice. Q4_K_M is a good starting point. Avoid BF16 for a first try on a phone: it can be much larger than a quantized file.
  5. Wait for the download to finish. A downloaded model appears under Ready to Use on the Models screen; downloading alone does not start it.
  6. Tap Load beside the model and wait for it to initialize. Return to Chat and send a message. The model stays loaded until you unload it or close/restart the app.

If you already have a compatible GGUF file on your phone, use + → Add Local Model instead. PocketPal also shows an Add Remote Model option, but that connects to another server rather than running the model on the phone.

Start with a small model: even a 2B model may be too much for an older phone, while smaller models can be less capable. If loading fails or the app closes, try a smaller GGUF and close other apps. Keep the phone nearby while it answers; longer responses can take time.

iPhone and iPad

PocketPal is also listed on the Apple App Store, but I haven’t tested the iOS setup myself, so I can’t promise the exact steps or model compatibility. Check the current app listing and its in-app model options before downloading a large file. If you send me screenshots of the iOS flow, I can make this section a precise walkthrough.

The short version

  1. Build llama.cpp (or install PocketPal on your phone).
  2. Download a GGUF model from Hugging Face; try Q4_K_M first.
  3. Start llama-server -m path/to/model.gguf and open http://localhost:9931.
  4. Start with Qwen 3.5 2B on a modest computer, or LittleLamb Tool-Calling if you specifically need a tiny tool-calling experiment. For more memory, try Qwen 3.5 4B or Gemma 4 E2B.

Local means the model runs on your device, but optional connected tools can still send requests to other services. Check the model license, and don’t give a tool permissions you wouldn’t give to another app.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.