README / README.md
marcelotiziano's picture
Fix broken relative links -> absolute GitHub URLs
acf6172 verified
|
Raw History Blame Contribute Delete
12.8 kB
---
title: README
emoji: πŸš€
colorFrom: indigo
colorTo: blue
sdk: static
pinned: false
---
# OpenScriptura
> **Open LLMs for Protestant Theology β€” any tradition, any language, built to last.**
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-gold.svg)](https://opensource.org/licenses/Apache-2.0)
[![HuggingFace](https://img.shields.io/badge/πŸ€—%20HuggingFace-openscriptura-yellow)](https://huggingface.co/openscriptura)
[![CEFEAI Benchmark](https://img.shields.io/badge/Benchmark-CEFEAI%20AFB-blue)](https://cefe.ai)
[![Python 3.11+](https://img.shields.io/badge/Python-3.11+-blue.svg)](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>