---
title: "Working with llama.cpp in Pixeltable"
description: "This tutorial demonstrates how to use Pixeltable's built-in llama.cpp integration to run local LLMs efficiently."
url: "https://www.pixeltable.com/notebooks/working-with-llama-cpp"
updated: "2026-10-25"
---

# Working with llama.cpp in Pixeltable

This tutorial demonstrates how to use Pixeltable's built-in llama.cpp integration to run local LLMs efficiently.

- **Type:** Notebook
- **Group:** Providers

## What it covers

- Create a table for chat completions
- Test chat completion
- Comparing models

## What it uses

- **Install:** `pip install pixeltable llama-cpp-python huggingface-hub`
- **Pixeltable calls:** `llama_cpp.create_chat_completion()`, `pxt.create_table()`, `add_computed_column()`, `insert()`

## A look at the code

```python
# Add a computed column that uses llama.cpp for chat completion
# against the input.

messages = [
    {'role': 'system', 'content': 'You are a helpful assistant.'},
    {'role': 'user', 'content': t.input},
]

t.add_computed_column(
    result=llama_cpp.create_chat_completion(
        messages,
        repo_id='Qwen/Qwen2.5-0.5B-Instruct-GGUF',
        repo_filename='*q5_k_m.gguf',
    )
)

# Extract the output content from the JSON structure returned
# by llama_cpp.

t.add_computed_column(output=t.result.choices[0].message.content)
```

## Open it

- **Open in Colab:** https://colab.research.google.com/github/pixeltable/pixeltable/blob/release/docs/release/howto/providers/working-with-llama-cpp.ipynb
- **Docs page:** https://docs.pixeltable.com/howto/providers/working-with-llama-cpp
- **Source on GitHub:** https://github.com/pixeltable/pixeltable/blob/release/docs/release/howto/providers/working-with-llama-cpp.ipynb
