# Miktam Bible | Part 2 — An AI Study Assistant That Runs on the Phone

> Source: <https://dev.to/ai2th/miktam-bible-part-2-an-ai-study-assistant-that-runs-on-the-phone-54h4>
> Published: 2026-11-15 16:11:52+00:00

Most AI features in apps are a thin wrapper around a cloud API. Miktam Bible's study assistant is different: the language model runs **on the phone**, and every answer is grounded in verses pulled from the offline database.

The assistant runs a small **SmolLM2** model, quantized to 4 bits in GGUF format, through [`llama.rn`](https://github.com/mybigday/llama.rn), the React Native binding for llama.cpp. The settings are chosen for phones:

```
context = await initLlama({
  model: nativePath,
  n_ctx: 2048,        // Mobile-safe context window
  n_batch: 256,       // Mobile-safe batch size
  n_threads: 4,       // CPU threads for inference
  n_gpu_layers: 0,    // 0 = CPU only
  use_mlock: false,
  use_mmap: true,     // Memory-map the model file
});
```

CPU-only with a memory-mapped model file keeps it working across the wide range of Android hardware. If the model has not been downloaded yet, or fails to load, the assistant falls back to showing the most relevant verses for your question directly.

A small model on its own will happily make things up. So every question goes through a retrieval step first:

```
Your question
  └── 1. Search the Bible (FTS5, with synonym expansion and stop words removed)
        └── 2. Take the 10 most relevant verses
              └── 3. Build the prompt: system prompt + those verses + your question
                    └── 4. Generate the answer on the phone
                          └── 5. Turn verse references in the answer into tappable links
```

The model is told to answer from the verses it was given, and any reference in its answer (for example `John 3:16`) becomes a link back into the reader.

Keyword search finds verses that share words with your question, not verses that share its meaning. The pipeline is already shaped for **hybrid search**: FTS5 results plus vector similarity (sqlite-vec), merged with reciprocal rank fusion. The missing piece is a small on-device embedding model (MiniLM); until it lands, the assistant uses FTS5 alone.

No API keys, no server, no logging of questions. You can put the phone in flight mode and the assistant still works.

**Next, Part 3:** reading plans and reminders that keep up with you.

Miktam Bible is in **Google Play closed testing**:

Different Play account? [Request access here](https://forms.gle/jdLxXPVhDYm5ubpQ7).
