Spaces:
Running
Running
File size: 12,844 Bytes
acf6172 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | ---
title: README
emoji: π
colorFrom: indigo
colorTo: blue
sdk: static
pinned: false
---
# OpenScriptura
> **Open LLMs for Protestant Theology β any tradition, any language, built to last.**
[](https://opensource.org/licenses/Apache-2.0)
[](https://huggingface.co/openscriptura)
[](https://cefe.ai)
[](https://python.org)
---
## What is OpenScriptura
OpenScriptura is an open-source applied research project that fine-tunes open LLMs with Protestant theological corpus β across **all Protestant traditions** and **all languages**.
**The problem:** Existing language models treat questions of faith with excessive neutrality or simply ignore the religious dimension. The [CEFEAI](https://cefe.ai/) benchmark demonstrated that all 27 frontier models tested in 2026 produce **0% predominantly religious responses** to everyday ethical questions, with even the best model (Grok 4.20) ignoring religious perspective 70% of the time.
**The solution:** Tradition-specific fine-tuning with high-quality confessional corpus, a three-layer validation pipeline, and scientifically comparable evaluation via CEFEAI.
**The scope:** OpenScriptura serves the full breadth of Protestant Christianity β Reformed, Lutheran, Anglican, Baptist, Methodist, Pentecostal, and beyond. Each tradition has its own confessional standards, its own dataset, and its own model variant. We start with Reformed theology in Brazilian Portuguese because that is where we started β not because that is where we end.
---
## Scientific Motivation
```
Base models β CEFEAI Religious Representation (May 2026, 150 questions):
Grok 4.20 ββββββββββββββββββββ 29.3% Any Representation
Mistral Large ββββββββββββββββββββ 23.3%
GPT-5.4 ββββββββββββββββββββ 17.3%
Qwen3-8B base ββββββββββββββββββββ ~6.0% β our starting point
Claude Opus 4.7 ββββββββββββββββββββ 4.0%
Llama 4 Scout ββββββββββββββββββββ 3.3%
Predominantly Religious: 0% across all 27 models tested.
OpenScriptura v0.1 target: ββββββββββββββββββββ > 60%
```
---
## Protestant Traditions
OpenScriptura is designed to serve the full breadth of Protestant Christianity. Each tradition is treated with fidelity to its own confessional standards β there is no attempt to blend incompatible doctrines.
| Tradition | Primary Confessional Standards | Status |
|---|---|---|
| **Reformed / Calvinist** | Westminster Confession of Faith, Canons of Dort, Heidelberg Catechism, London Baptist Confession 1689 | π **v0.1 β first release** |
| **Lutheran** | Augsburg Confession (1530), Luther's Small & Large Catechisms, Formula of Concord | π Planned |
| **Anglican / Episcopal** | Thirty-Nine Articles (1571), Book of Common Prayer | π Planned |
| **Baptist (Traditional)** | Second London Confession (1689), New Hampshire Confession (1833), Baptist Faith & Message | π Planned |
| **Methodist / Wesleyan** | Wesley's Articles of Religion, Methodist Discipline | π Planned |
| **Pentecostal** | Assemblies of God Statement of Fundamental Truths | π Planned |
| **Congregationalist** | Savoy Declaration (1658) | π Planned |
| **Other Protestant** | Community contributions welcome | π Open |
> **Note on tradition boundaries:** Models are labeled clearly by tradition. A Reformed model will not speak as a Lutheran, and vice versa. Where traditions share common ground (e.g. justification by faith), datasets naturally overlap. Where they diverge (e.g. baptism, Lord's Supper, church governance), each tradition's dataset reflects its own confessional position.
---
## Published Models
| Model | Base | Tradition | Language | CEFEAI RR | Download |
|---|---|---|---|---|---|
| `qwen3-8b-reformed-pt-br-v0.1` | Qwen3-8B | Reformed | PT-BR | π pending | [HF Hub](https://huggingface.co/openscriptura/qwen3-8b-reformed-pt-br-v0.1) |
| `qwen3-8b-lutheran-en-v0.1` | Qwen3-8B | Lutheran | EN | π planned | β |
| `gpt-oss-20b-v1.0` | GPT-OSS 20B | Multi-tradition | Multilingual | π planned | β |
Model naming convention: `openscriptura/{base}-{tradition}-{lang}-{version}`
---
## Repository Structure
```
openscriptura/
βββ README.md
βββ CONTRIBUTING.md
βββ LICENSE # Apache 2.0
βββ requirements.txt
β
βββ traditions/ # One folder per tradition
β βββ reformed/
β β βββ data/
β β β βββ tier_c/ # Native Q&A β catechisms
β β β β βββ westminster_sc.jsonl
β β β β βββ westminster_lc.jsonl
β β β β βββ heidelberg.jsonl
β β β β βββ canons_dort.jsonl
β β β βββ tier_b/ # Sermons and texts
β β β βββ tier_a/ # Structured doctrinal topics
β β βββ configs/
β β βββ confessions.yaml # WCF, Dort, LCF references
β βββ lutheran/
β β βββ data/
β β βββ configs/
β β βββ confessions.yaml # Augsburg, Book of Concord
β βββ anglican/
β βββ baptist/
β βββ methodist/
β βββ pentecostal/
β
βββ data/
β βββ processed/
β βββ reformed-pt-br-v1.0/
β β βββ train.jsonl # 4,800 examples (seed=42)
β β βββ eval.jsonl # 600 examples
β β βββ test.jsonl # 600 examples (holdout)
β β βββ manifest.json # SHA-256 per split
β βββ lutheran-en-v1.0/
β
βββ scripts/
β βββ 00_cefeai_baseline.py
β βββ 01_extract_tier_c.py
β βββ 02_extract_tier_b.py
β βββ 03_confessional_judge.py # Tradition-aware judge
β βββ 04_merge_dataset.py
β βββ 05_train.py
β βββ 06_evaluate.py
β βββ 07_cefeai_eval.py
β
βββ configs/
β βββ exp_a.yaml # LR=2e-4, rank=32
β βββ exp_b.yaml # LR=2e-4, rank=64
β βββ exp_c.yaml # LR=1e-4, rank=32
β βββ exp_d.yaml # LR=1e-4, rank=64 (default)
β
βββ notebooks/
β βββ 01_baseline_analysis.ipynb
β βββ 02_dataset_eda.ipynb
β βββ 03_results_comparison.ipynb
β
βββ docs/
βββ METHODOLOGY.md
βββ THEOLOGICAL_STATEMENT.md
βββ ADDING_A_TRADITION.md # Guide: how to add a new tradition
βββ ADDING_A_LANGUAGE.md # Guide: how to add a new language
```
---
## Quick Start
### Requirements
```bash
Python 3.11+
CUDA 12.4+
GPU: RTX 4090 (24GB) minimum for experiments
A100 80GB recommended for final run
```
### Installation
```bash
git clone https://github.com/openscriptura/qwen3-8b-reformed-pt-br-v0.1
cd openscriptura
pip install -r requirements.txt --break-system-packages
cp .env.example .env
# Edit .env with API keys (OpenRouter, HuggingFace)
```
### Run CEFEAI baseline
```bash
# Cost: ~$0.29 | Time: ~2h
python scripts/00_cefeai_baseline.py --model qwen/qwen3-8b --benchmark rr
python scripts/00_cefeai_baseline.py --model qwen/qwen3-8b --benchmark cb
```
### Build the dataset (Reformed PT-BR v0.1)
```bash
python scripts/01_extract_tier_c.py --tradition reformed
python scripts/02_extract_tier_b.py --tradition reformed --lang pt-BR
python scripts/03_confessional_judge.py --tradition reformed
python scripts/04_merge_dataset.py --tradition reformed --seed 42
```
### Fine-tuning
```bash
# Free validation on Kaggle
python scripts/05_train.py --config configs/exp_d.yaml --tradition reformed --samples 500
# Full run β RunPod Secure A100
python scripts/05_train.py --config configs/exp_d.yaml --tradition reformed --full
```
---
## Dataset Schema (v1.0)
`tradition` and `language` are first-class fields. The same schema works for any Protestant tradition in any language:
```json
{
"id": "os_reformed_c_wsc_001",
"instruction": "What is justification by faith alone?",
"input": "",
"output": "Justification is the forensic act by which God declares the sinner righteous...",
"source": "westminster_sc_q033",
"tier": "C",
"tradition": "reformed",
"confessional_ref": "WCF_11.1",
"language": "pt-BR",
"difficulty": "intermediate",
"annotation_model": "deepseek-v4-flash",
"validated_by": "gemini-flash-2",
"confidence": 0.94,
"confessional_score": 0.91,
"dataset_version": "v1.0",
"created_at": "2026-06-07"
}
```
`tradition` values: `reformed` Β· `lutheran` Β· `anglican` Β· `baptist` Β· `methodist` Β· `pentecostal` Β· `congregationalist`
`language` follows BCP 47: `pt-BR` Β· `en` Β· `es` Β· `de` Β· `fr` Β· etc.
---
## Fine-tuning Configuration
```yaml
# configs/exp_d.yaml β default (OpenMed config D)
model:
name: Qwen/Qwen3-8B
load_in_4bit: true
bnb_4bit_quant_type: nf4
bnb_4bit_use_double_quant: true
lora:
r: 64
lora_alpha: 64
lora_dropout: 0.05
target_modules: [q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj]
training:
per_device_train_batch_size: 4
gradient_accumulation_steps: 4
num_train_epochs: 3
learning_rate: 1e-4
lr_scheduler_type: cosine
warmup_ratio: 0.05
bf16: true
max_seq_length: 2048
seed: 42
```
**Cost per model variant:** ~$11β17 total (dataset generation + fine-tuning + evaluation).
---
## Roadmap
```
Phase 1 β Reformed Foundation
v0.1 Qwen3-8B Β· Reformed Β· PT-BR β we are here
v0.2 GPT-OSS 20B Β· Reformed Β· PT-BR+EN
v0.3 Gemma 4 31B Β· Reformed Β· multilingual
Phase 2 β Tradition Expansion
v1.0 Lutheran Β· EN (Book of Concord corpus)
v1.1 Anglican Β· EN (39 Articles + BCP)
v1.2 Baptist Β· EN + PT-BR
Phase 3 β Community-Driven
v2.x Methodist, Pentecostal, Congregationalist
v2.x Spanish, German, indigenous languages
v3.0 Multi-tradition unified benchmark paper
```
---
## Contributing
We welcome contributions across all Protestant traditions and languages.
**New tradition:** see [`docs/ADDING_A_TRADITION.md`](https://github.com/openscriptura/qwen3-8b-reformed-pt-br-v0.1/blob/main/docs/ADDING_A_TRADITION.md). You need: primary confessional standards, a seed corpus of at least 200 examples, and one person willing to do pastoral review.
**New language:** see [`docs/ADDING_A_LANGUAGE.md`](https://github.com/openscriptura/qwen3-8b-reformed-pt-br-v0.1/blob/main/docs/ADDING_A_LANGUAGE.md).
**Dataset examples:** open an issue with theological Q&A in any tradition and language. Include the confessional reference.
**Doctrinal corrections:** open an issue with the problematic example and the correct reference.
**Code:** issues labeled `good first issue`.
---
## Citation
```bibtex
@misc{openscriptura2026,
title = {OpenScriptura: Open LLMs for Protestant Theology},
author = {OpenScriptura Contributors},
year = {2026},
howpublished = {\url{https://github.com/openscriptura/qwen3-8b-reformed-pt-br-v0.1}},
note = {Apache 2.0. Multi-tradition, language-agnostic pipeline.
Benchmarked against CEFEAI AllFaith Benchmark.}
}
```
---
## License
Apache 2.0 β see [`LICENSE`](https://github.com/openscriptura/qwen3-8b-reformed-pt-br-v0.1/blob/main/LICENSE). Free use including commercial. Attribution required.
---
<div align="center">
**Soli Deo Gloria**
*For the glory of God and the good of the Church β in every tradition and every language.*
[HuggingFace](https://huggingface.co/openscriptura) Β· [CEFEAI](https://cefe.ai) Β· [Issues](https://github.com/openscriptura/qwen3-8b-reformed-pt-br-v0.1/issues)
</div>
|