Skip to content

Douft/Berean

Repository files navigation

Berean

A private, on-device assistant for studying and discussing the King James Bible. It helps a person research the text, gather the passages that bear on a question, and reason about life's matters grounded in Scripture — Jesus's teachings and the Gospels first, but not limited to them: the whole counsel of the sixty-six books.

It is built to be given away, not sold (MIT), and it runs entirely on the device — nothing a person discusses ever leaves their phone — so people can bring real questions, and real struggles, to the text in private.

"...they received the word with all readiness of mind, and searched the scriptures daily, whether those things were so." — Acts 17:11


Get the app

Download: douft.ca/berean — a single APK (~2.5 GB) with everything inside: the app, the Berean model, and the offline voice model. No account, no store, and after the download it never touches the network. It is an early version, still being proven in daily use — the download page lists the hardware it needs (64-bit Android, 8 GB RAM recommended, ~8 GB free storage during install). New builds replace the same link.


What makes it trustworthy

The assistant's honesty does not rest on a language model's memory. By design (see docs/constitution.md — the Reverence Guardrail):

  • Every verse shown is retrieved verbatim from a verified KJV corpus carried in the app (scripture/), exact and cited — never generated, paraphrased, or remembered by the model. The model can drift; the text cannot.
  • The model frames; the corpus speaks. The model's job is to understand a question, find the relevant passages, and connect them in plain words. The Scripture itself is always the verified text, set visibly apart from the framing so a reader can always tell the Word from the words about it.
  • Faithful and complete (Constitution, Article II): the text is presented whole and unsoftened — no outside interpretation, no modern political gloss in either direction — it neither condemns nor condones; it finds the relevant Scripture and lets it speak.

Because retrieval, not the weights, owns the sacred text, the app is trustworthy about the verse it shows before any model training even enters the picture.

The KJV corpus is independently certified verbatim (66 books / 1,189 chapters / 31,102 verses) and word-for-word cross-checked against independent digitizations — see docs/corpus-certification.md. You can re-run the proof yourself:

node scripts/certify-corpus.js        # structure, canon, source diff, spot checks
node scripts/crosscheck-witnesses.js  # word-for-word vs. independent digitizations
yarn test                             # incl. byte-equality through retrieval

The model — Berean

  • A specialized, on-device language model named Berean (after the Bereans of Acts 17:11, who searched the Scriptures daily to verify what they were taught). It is a pattern-recognition tool, not a living thing — see the Constitution's naming article.
  • Base: Qwen (Apache-2.0). Berean is distilled onto this base — taught to reason under the Constitution and to defer to retrieval for every verse — not trained from scratch.
  • Shipped as a quantized GGUF and run locally via llama.rn (llama.cpp), with an Adreno/OpenCL GPU path and a clean CPU fallback. No Hugging Face or any network dependency at runtime.

The model weights are not stored in this repository. The GGUF is ~2.2 GB, which exceeds GitHub's file limits. The full, reproducible distillation pipeline — corpus assembly, audit gate, and Colab training — lives in training/; see docs/train-berean-colab.html for the end-to-end walkthrough and docs/berean-v0-report.html for how the first model (berean-v0) was trained.

To run the app with a model, place a Berean GGUF at android/app/src/main/assets/models/berean-v0.Q4_0.gguf (git-ignored). On first launch the app unpacks it into its private storage; a model pushed to the device's app storage overrides the bundled one. Voice input likewise expects the Whisper model at android/app/src/main/assets/whisper/ggml-base.en.bin (git-ignored, ggml base.en) — without it the mic button simply doesn't appear. The prebuilt APK from douft.ca/berean ships both models already in place.


The app

Built clean, from scratch, around the model — not a fork of any general chat app. It keeps only the proven on-device inference binding (llama.rn, which wraps llama.cpp with the Adreno/OpenCL GPU path) and drops everything else: no model marketplace, no remote downloads, no accounts, no unused surface.

  • On-device and private. All inference and all conversation stay on the phone. The release build declares no INTERNET permission at all — it cannot phone home. (INTERNET lives only in the debug manifest, for the Metro bundler.)
  • Memory-safe inference spine. GPU memory is explicitly released on every teardown path, so a study session can end cleanly without orphaning the model's allocation — see docs/memory-lifecycle.md.
  • Voice, optional and local. Speech in/out runs on-device (whisper.rn); audio never leaves the phone.
  • Reading tool with local, Scripture-aware reminders — generated on the device, honoring the same privacy promise.

Build & run (Android)

Prerequisites: Node ≥ 20, Yarn 3.6.4 (pinned via .yarnrc.yml), and a working React Native 0.82 / Android toolchain (Android SDK + NDK).

yarn install
# place a Berean GGUF at android/app/src/main/assets/models/berean-v0.Q4_0.gguf
yarn android              # debug build to a connected device/emulator
yarn android:release      # release APK (no INTERNET permission)

Useful checks: yarn lint, yarn typecheck, yarn test.


Repository layout

scripture/          The verified KJV corpus — the load-bearing asset.
  kjv.json            All 66 books, verbatim (the retrieval source of truth).
  red-letter.json     The words of Christ.
  source/             The raw OSIS XML and witnesses the JSON is proven against.
src/                The app's TypeScript: inference spine, retrieval/scoring,
                    reverence guard, reader/reminders, voice, UI.
App.tsx             The React Native app entry.
android/ · ios/     Native project shells (Android is the primary target).
scripts/            Corpus certification & build tools (run with node).
training/           The Hugging-Face-free distillation pipeline for Berean:
                    corpus seeds, assembly, audit gate, and Colab training.
docs/               Constitution, corpus certification, memory lifecycle, and
                    the training walkthrough.

A request to those who build on this

This project is fully MIT (see LICENSE) — you may use, modify, and redistribute it freely, including commercially. That freedom is deliberate: it is meant to be given away.

The license places no restriction on you, but the project does carry a plea. It was built on one principle above all — that the Word be handled with reverence and never corrupted: every verse shown exact, cited, and unaltered; the text presented whole, neither softened nor bent to any agenda (see docs/constitution.md). If you build on this work, the one ask — a request, not a legal condition — is that you keep it truthful and reverent toward Scripture, and do not turn it to the opposite of what it was made for. Please don't use it to misrepresent the text or to bear false witness about God.


License & author

MIT — free to use, given away, not sold. See LICENSE. The King James text carried in scripture/ is in the public domain.

Developed by David Neufeld · Douft.ca

About

A local android app, with its own custom trained Berean.llm built off of Qwen-4B-GPU

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages