Omarito101 commited on
Commit
a6256cd
Β·
verified Β·
1 Parent(s): 3ff0bd8

Update model after training on balanced dataset (95.6K examples, 3 epochs)

Browse files
Files changed (1) hide show
  1. README.md +59 -28
README.md CHANGED
@@ -1,7 +1,7 @@
1
  ---
2
  language: en
3
  license: llama3.1
4
- library_name: peft
5
  tags:
6
  - text-classification
7
  - energy
@@ -13,13 +13,10 @@ tags:
13
  - energy-documents
14
  pipeline_tag: text-classification
15
  widget:
16
- - text: Solar energy has become increasingly cost-competitive with fossil fuels in
17
- recent years. The price of photovoltaic panels has dropped significantly, making
18
- renewable energy more accessible.
19
- example_title: Energy Document
20
- - text: The committee discussed the implementation of new operational guidelines.
21
- Training sessions will be conducted for all staff members next month.
22
- example_title: Non-Energy Document
23
  datasets:
24
  - custom
25
  metrics:
@@ -39,51 +36,88 @@ model-index:
39
  type: custom
40
  metrics:
41
  - type: accuracy
42
- value: 0.9806
43
  name: Test Accuracy
44
  verified: true
45
  - type: f1
46
- value: 0.9807
47
  name: Test F1 Score
48
  verified: true
49
  - type: precision
50
- value: 0.9747
51
  name: Test Precision
52
  verified: true
53
  - type: recall
54
- value: 0.9869
55
  name: Test Recall
56
  verified: true
57
  - type: roc_auc
58
- value: 0.9935
59
  name: ROC-AUC
60
  verified: true
61
  ---
62
 
63
  # πŸ”‹ Llama-3.1-8B Energy Document Classifier
64
 
65
- A fine-tuned **Llama-3.1-8B** model for binary classification of energy-related documents, achieving **98.06% accuracy** on test data.
66
 
67
- This model uses **LoRA (Low-Rank Adaptation)** for parameter-efficient fine-tuning, making it lightweight and fast while maintaining high performance.
68
 
69
  ## πŸ“Š Model Performance
70
 
 
 
71
  | Metric | Score |
72
  |--------|-------|
73
- | **Test Accuracy** | 98.06% |
74
- | **F1 Score** | 98.07% |
75
- | **Precision** | 97.47% |
76
- | **Recall** | 98.69% |
77
- | **ROC-AUC** | 99.35% |
 
 
78
 
79
- ### Confusion Matrix (Test Set - 3,818 samples)
 
 
 
 
 
 
 
 
80
 
81
  | | Predicted Non-Energy | Predicted Energy |
82
  |--|---------------------|------------------|
83
- | **Actual Non-Energy** | 1,860 (97.43%) | 49 (2.57%) |
84
- | **Actual Energy** | 25 (1.31%) | 1,884 (98.69%) |
85
-
86
- **Only 74 misclassifications out of 3,818 documents!**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
 
88
  ## 🎯 Use Cases
89
 
@@ -549,6 +583,3 @@ For questions or issues:
549
  ---
550
 
551
  **Happy Classifying! πŸ”‹βš‘**
552
- ### Framework versions
553
-
554
- - PEFT 0.12.0
 
1
  ---
2
  language: en
3
  license: llama3.1
4
+ library_name: transformers
5
  tags:
6
  - text-classification
7
  - energy
 
13
  - energy-documents
14
  pipeline_tag: text-classification
15
  widget:
16
+ - text: "Solar energy has become increasingly cost-competitive with fossil fuels in recent years. The price of photovoltaic panels has dropped significantly, making renewable energy more accessible."
17
+ example_title: "Energy Document"
18
+ - text: "The committee discussed the implementation of new operational guidelines. Training sessions will be conducted for all staff members next month."
19
+ example_title: "Non-Energy Document"
 
 
 
20
  datasets:
21
  - custom
22
  metrics:
 
36
  type: custom
37
  metrics:
38
  - type: accuracy
39
+ value: 0.9839
40
  name: Test Accuracy
41
  verified: true
42
  - type: f1
43
+ value: 0.9841
44
  name: Test F1 Score
45
  verified: true
46
  - type: precision
47
+ value: 0.9717
48
  name: Test Precision
49
  verified: true
50
  - type: recall
51
+ value: 0.9969
52
  name: Test Recall
53
  verified: true
54
  - type: roc_auc
55
+ value: 0.9976
56
  name: ROC-AUC
57
  verified: true
58
  ---
59
 
60
  # πŸ”‹ Llama-3.1-8B Energy Document Classifier
61
 
62
+ A fine-tuned **Llama-3.1-8B** model for binary classification of energy-related documents, achieving **98.39% accuracy** on test data.
63
 
64
+ This model uses **LoRA (Low-Rank Adaptation)** for parameter-efficient fine-tuning, trained on **95,602 documents** (perfectly balanced: 47,801 energy + 47,801 non-energy).
65
 
66
  ## πŸ“Š Model Performance
67
 
68
+ ### Test Set Results (9,562 documents)
69
+
70
  | Metric | Score |
71
  |--------|-------|
72
+ | **Test Accuracy** | 98.39% |
73
+ | **F1 Score** | 98.41% |
74
+ | **Precision** | 97.17% |
75
+ | **Recall** | 99.69% |
76
+ | **ROC-AUC** | 99.76% |
77
+
78
+ ### Validation Set Results (9,560 documents)
79
 
80
+ | Metric | Score |
81
+ |--------|-------|
82
+ | **Val Accuracy** | 98.55% |
83
+ | **Val F1 Score** | 98.56% |
84
+ | **Val Precision** | 97.54% |
85
+ | **Val Recall** | 99.60% |
86
+ | **Val ROC-AUC** | 99.76% |
87
+
88
+ ### Confusion Matrix (Test Set - 9,562 documents)
89
 
90
  | | Predicted Non-Energy | Predicted Energy |
91
  |--|---------------------|------------------|
92
+ | **Actual Non-Energy** | 4,642 (97.09%) | 139 (2.91%) |
93
+ | **Actual Energy** | 15 (0.31%) | 4,766 (99.69%) |
94
+
95
+ **Only 154 misclassifications out of 9,562 documents (1.61% error rate)!**
96
+
97
+ ### Training Details
98
+
99
+ - **Base Model**: meta-llama/Llama-3.1-8B
100
+ - **Training Method**: LoRA (r=16, alpha=32, dropout=0.05)
101
+ - **Target Modules**: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
102
+ - **Trainable Parameters**: 45M out of 8B (0.56%)
103
+ - **Total Dataset**: 95,602 documents (perfectly balanced)
104
+ - Train: 76,480 (38,240 energy + 38,240 non-energy)
105
+ - Val: 9,560 (4,780 energy + 4,780 non-energy)
106
+ - Test: 9,562 (4,781 energy + 4,781 non-energy)
107
+ - **Energy Data Sources**:
108
+ - EnergyAI/finepdfs_energy (40,989 docs)
109
+ - EnergyAI/wikipedia_energy (5,459 docs)
110
+ - EnergyAI/eartharxiv_engrxiv_energy (27 docs)
111
+ - EnergyAI/scored_chunks_from_SPE_pipeline (1,326 docs)
112
+ - **Training Time**: ~2 hours on 4Γ— A100 80GB GPUs
113
+ - **Convergence**: Early stopping at step 1,100 (< 1 epoch!)
114
+ - **Effective Batch Size**: 64 (per_device=4, gradient_accum=4, 4 GPUs)
115
+ - **Learning Rate**: 2e-5 with cosine schedule and 10% warmup
116
+ - **Precision**: bfloat16 mixed precision
117
+
118
+ ### Data Curation
119
+
120
+ Energy-labeled documents were sourced from four HuggingFace datasets (see above). Non-energy documents were sampled from a base document pipeline, with deduplication to ensure no overlap with energy documents (validated by both document ID and MD5 hash matching).
121
 
122
  ## 🎯 Use Cases
123
 
 
583
  ---
584
 
585
  **Happy Classifying! πŸ”‹βš‘**