LoveJesus commited on
Commit
a32fe41
·
verified ·
1 Parent(s): 63e5d78

Update model card with v2 retrained metrics (macro F1: 0.42 -> 0.761)

Browse files
Files changed (1) hide show
  1. README.md +63 -47
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
- - intertextuality
9
  - roberta
10
- pipeline_tag: text-classification
11
- library_name: transformers
12
- base_model: roberta-base
13
  datasets:
14
  - LoveJesus/intertextual-dataset-chirho
 
 
 
 
15
  ---
16
 
17
- # Intertextual Classifier (RoBERTa-base) - chirho
18
 
19
- *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*
20
 
21
- ## Description
22
 
23
- A RoBERTa-base model fine-tuned for **classifying the type of connection** between pairs of Bible verses. Given two verses (as a sentence pair), it predicts one of 7 connection types.
24
 
25
- ## Connection Types
26
 
27
- | Label | Description | Example |
28
- |-------|-------------|---------|
29
- | `direct_quote` | NT directly quotes OT | Mt 1:23 quotes Is 7:14 |
30
- | `allusion` | Clear reference without direct quotation | Rev 5:5 alludes to Gen 49:9 |
31
- | `thematic_parallel` | Shared theme or motif | Ps 23 parallels Jn 10 |
32
- | `typological` | OT type foreshadows NT antitype | Isaac sacrifice prefigures Christ |
33
- | `prophecy_fulfillment` | OT prophecy fulfilled in NT | Is 53 in Passion narratives |
34
- | `parallel_narrative` | Same event in parallel accounts | Synoptic parallels |
35
- | `contrast` | Deliberate theological contrast | Adam vs Christ (Rom 5) |
36
 
37
- ## Training
38
 
39
- - **Base model**: roberta-base
40
- - **Task**: Single-label classification (7 classes)
41
- - **Data**: 28,612 Grok-labeled cross-reference pairs (class-weighted loss for imbalance)
42
- - **Epochs**: 8 (early stopping patience=3)
43
- - **Batch size**: 16
44
- - **Device**: Apple MPS (M4 Pro)
45
 
46
- ## Evaluation (Test Set)
47
 
48
- - **F1 macro**: 0.42 | **Accuracy**: 70% | **Weighted F1**: 0.72
 
 
 
 
 
 
49
 
50
- | Class | Precision | Recall | F1 |
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
- *Note: Class imbalance (75.9% thematic_parallel) limits macro F1. Weighted F1 of 0.72 better reflects practical performance.*
 
 
 
 
 
 
 
61
 
62
  ## Usage
63
 
64
  ```python
65
  from transformers import pipeline
66
 
67
- classifier = pipeline("text-classification", model="LoveJesus/intertextual-classifier-chirho")
 
 
 
 
 
 
68
 
69
- result = classifier({
70
- "text": "Therefore the Lord himself shall give you a sign; Behold, a virgin shall conceive",
71
- "text_pair": "Now all this was done, that it might be fulfilled which was spoken of the Lord by the prophet"
72
- })
73
- # → prophecy_fulfillment
74
  ```
75
 
76
- ## Part of models-chirho
 
 
77
 
78
- Paired with [LoveJesus/intertextual-embedder-chirho](https://huggingface.co/LoveJesus/intertextual-embedder-chirho) for full cross-reference discovery.
 
79
 
80
- Built with love for Jesus by [loveJesus](https://huggingface.co/LoveJesus).
 
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)