Update model card with v2 retrained metrics (macro F1: 0.42 -> 0.761)
Browse files
README.md
CHANGED
|
@@ -1,80 +1,96 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
| 2 |
language: en
|
| 3 |
license: mit
|
| 4 |
tags:
|
| 5 |
-
- text-classification
|
| 6 |
- bible
|
|
|
|
|
|
|
| 7 |
- cross-reference
|
| 8 |
-
-
|
| 9 |
- roberta
|
| 10 |
-
|
| 11 |
-
library_name: transformers
|
| 12 |
-
base_model: roberta-base
|
| 13 |
datasets:
|
| 14 |
- LoveJesus/intertextual-dataset-chirho
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
---
|
| 16 |
|
| 17 |
-
# Intertextual Classifier (
|
| 18 |
|
| 19 |
-
*
|
| 20 |
|
| 21 |
-
|
| 22 |
|
| 23 |
-
|
| 24 |
|
| 25 |
-
|
| 26 |
|
| 27 |
-
| Label | Description |
|
| 28 |
-
|-------|-------------|
|
| 29 |
-
| `
|
| 30 |
-
| `
|
| 31 |
-
| `
|
| 32 |
-
| `typological` | OT type
|
| 33 |
-
| `
|
| 34 |
-
| `
|
| 35 |
-
| `
|
| 36 |
|
| 37 |
-
## Training
|
| 38 |
|
| 39 |
-
- **Base model**: roberta-base
|
| 40 |
-
- **
|
| 41 |
-
- **
|
| 42 |
-
- **Epochs**: 8
|
| 43 |
-
- **
|
| 44 |
-
- **Device**: Apple MPS (M4 Pro)
|
| 45 |
|
| 46 |
-
##
|
| 47 |
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|-------|-----------|--------|-----|
|
| 52 |
-
| thematic_parallel | 0.91 | 0.76 | **0.83** |
|
| 53 |
-
| direct_quote | 0.48 | 0.66 | **0.56** |
|
| 54 |
-
| typological | 0.28 | 0.52 | **0.37** |
|
| 55 |
-
| parallel_narrative | 0.26 | 0.55 | **0.36** |
|
| 56 |
-
| prophecy_fulfillment | 0.30 | 0.44 | **0.35** |
|
| 57 |
-
| allusion | 0.28 | 0.27 | **0.28** |
|
| 58 |
-
| contrast | 0.13 | 0.24 | **0.17** |
|
| 59 |
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
## Usage
|
| 63 |
|
| 64 |
```python
|
| 65 |
from transformers import pipeline
|
| 66 |
|
| 67 |
-
classifier = pipeline(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
-
result = classifier(
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
})
|
| 73 |
-
# → prophecy_fulfillment
|
| 74 |
```
|
| 75 |
|
| 76 |
-
## Part of
|
|
|
|
|
|
|
| 77 |
|
| 78 |
-
|
|
|
|
| 79 |
|
| 80 |
-
|
|
|
|
| 1 |
---
|
| 2 |
+
# For God so loved the world that he gave his only begotten Son,
|
| 3 |
+
# that whoever believes in him should not perish but have eternal life. - John 3:16
|
| 4 |
language: en
|
| 5 |
license: mit
|
| 6 |
tags:
|
|
|
|
| 7 |
- bible
|
| 8 |
+
- chirho
|
| 9 |
+
- intertextual
|
| 10 |
- cross-reference
|
| 11 |
+
- classification
|
| 12 |
- roberta
|
| 13 |
+
- bible-ml
|
|
|
|
|
|
|
| 14 |
datasets:
|
| 15 |
- LoveJesus/intertextual-dataset-chirho
|
| 16 |
+
base_model: roberta-base
|
| 17 |
+
metrics:
|
| 18 |
+
- f1
|
| 19 |
+
pipeline_tag: text-classification
|
| 20 |
---
|
| 21 |
|
| 22 |
+
# Intertextual Classifier (Chirho)
|
| 23 |
|
| 24 |
+
**RoBERTa-base fine-tuned for classifying biblical cross-reference connection types.**
|
| 25 |
|
| 26 |
+
> "For God so loved the world that he gave his only begotten Son, that whoever believes in him should not perish but have eternal life." - John 3:16
|
| 27 |
|
| 28 |
+
## Model Description
|
| 29 |
|
| 30 |
+
Given two Bible passages that are cross-referenced, this model classifies the type of intertextual connection between them into one of 7 categories:
|
| 31 |
|
| 32 |
+
| Label | Description |
|
| 33 |
+
|-------|-------------|
|
| 34 |
+
| `thematic_parallel` | Passages share the same theme or topic |
|
| 35 |
+
| `direct_quote` | One passage directly quotes another |
|
| 36 |
+
| `prophetic_fulfillment` | OT prophecy fulfilled in NT |
|
| 37 |
+
| `typological` | OT type foreshadowing NT antitype |
|
| 38 |
+
| `contrast` | Passages present contrasting ideas |
|
| 39 |
+
| `historical_narrative` | Shared historical events or figures |
|
| 40 |
+
| `theological_expansion` | Later passage expands on earlier theology |
|
| 41 |
|
| 42 |
+
## Training Details
|
| 43 |
|
| 44 |
+
- **Base model**: `roberta-base` (125M params)
|
| 45 |
+
- **Training data**: 19,164 balanced examples (Grok-labeled from TSK cross-references)
|
| 46 |
+
- **Class balancing**: WeightedTrainer with inverse-frequency CrossEntropyLoss + majority class capping
|
| 47 |
+
- **Epochs**: 8
|
| 48 |
+
- **Best epoch**: 8 (by eval loss)
|
|
|
|
| 49 |
|
| 50 |
+
## Metrics (v2 - Retrained Feb 2026)
|
| 51 |
|
| 52 |
+
| Metric | Value |
|
| 53 |
+
|--------|-------|
|
| 54 |
+
| **Macro F1** | **0.761** |
|
| 55 |
+
| Micro F1 | 0.853 |
|
| 56 |
+
| Precision | 0.665 |
|
| 57 |
+
| Recall | 0.939 |
|
| 58 |
+
| Eval Loss | 0.501 |
|
| 59 |
|
| 60 |
+
### Improvement over v1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
+
| Metric | v1 (Original) | v2 (Retrained) | Change |
|
| 63 |
+
|--------|---------------|----------------|--------|
|
| 64 |
+
| Macro F1 | 0.42 | **0.761** | +81% |
|
| 65 |
+
| Micro F1 | 0.72 | **0.853** | +18% |
|
| 66 |
+
|
| 67 |
+
**Root cause of v1 weakness**: 76% class imbalance (thematic_parallel dominated). Fixed with:
|
| 68 |
+
1. Balanced dataset (cap majority class, keep all minority examples)
|
| 69 |
+
2. WeightedTrainer with inverse-frequency class weights
|
| 70 |
|
| 71 |
## Usage
|
| 72 |
|
| 73 |
```python
|
| 74 |
from transformers import pipeline
|
| 75 |
|
| 76 |
+
classifier = pipeline(
|
| 77 |
+
"text-classification",
|
| 78 |
+
model="LoveJesus/intertextual-classifier-chirho",
|
| 79 |
+
top_k=None,
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
text = "[CLS] Genesis 3:15 And I will put enmity between thee and the woman, and between thy seed and her seed; it shall bruise thy head, and thou shalt bruise his heel. [SEP] Galatians 4:4 But when the fulness of the time was come, God sent forth his Son, made of a woman, made under the law [SEP]"
|
| 83 |
|
| 84 |
+
result = classifier(text)
|
| 85 |
+
print(result)
|
| 86 |
+
# [{'label': 'prophetic_fulfillment', 'score': 0.95}, ...]
|
|
|
|
|
|
|
| 87 |
```
|
| 88 |
|
| 89 |
+
## Part of Bible ML Pipeline
|
| 90 |
+
|
| 91 |
+
This model is part of the [Intertextual Reference Network](https://huggingface.co/spaces/LoveJesus/intertextual-reference-network-chirho) pipeline:
|
| 92 |
|
| 93 |
+
1. **Embedder** ([LoveJesus/intertextual-embedder-chirho](https://huggingface.co/LoveJesus/intertextual-embedder-chirho)): Finds similar passages
|
| 94 |
+
2. **Classifier** (this model): Classifies the connection type
|
| 95 |
|
| 96 |
+
Dataset: [LoveJesus/intertextual-dataset-chirho](https://huggingface.co/datasets/LoveJesus/intertextual-dataset-chirho)
|