shainaraza commited on
Commit
cefb5ae
1 Parent(s): 7cf8421

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +86 -0
README.md ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc
3
+ datasets:
4
+ - vector-institute/newsmediabias-plus
5
+ language:
6
+ - en
7
+ tags:
8
+ - bias
9
+ - classification
10
+ - llm
11
+ - multimodal
12
+ ---
13
+
14
+ # Llama3.2 NLP Bias Classifier
15
+
16
+ This model merges the base Llama-3.2 architecture with a custom adapter to classify text for disinformation likelihood, leveraging NLP techniques for high accuracy in distinguishing manipulative content from unbiased sources. It focuses on detecting rhetorical techniques commonly used in disinformation, offering both 'Likely' and 'Unlikely' classifications based on structured indicators.
17
+
18
+ ## Model Details
19
+
20
+ - **Base Model**: [meta-llama/Llama-3.2-1B-Instruct](https://huggingface.co/meta-llama/Lla
21
+ - **Deployment Environment**: Configured for GPU (CUDA) support.
22
+
23
+ ## Model Usage
24
+
25
+ ```python
26
+ import torch
27
+ from transformers import AutoModelForCausalLM, AutoTokenizer
28
+ import pandas as pd
29
+
30
+ # Load tokenizer and model
31
+ tokenizer = AutoTokenizer.from_pretrained("save_directory")
32
+ model = AutoModelForCausalLM.from_pretrained("save_directory", torch_dtype=torch.float16).to(device)
33
+ ```
34
+
35
+ ### Generating Predictions
36
+
37
+ The model evaluates text for disinformation by identifying rhetorical techniques. To classify input text, use the `generate_response` function:
38
+
39
+ ```python
40
+ def generate_response(model, prompt):
41
+ inputs = tokenizer(prompt, return_tensors="pt", padding=True, truncation=True, max_length=1024).to(device)
42
+ outputs = model.generate(inputs['input_ids'], max_new_tokens=50, temperature=0.7, top_p=0.95)
43
+ return tokenizer.decode(outputs[0], skip_special_tokens=True).strip()
44
+ ```
45
+
46
+ ## Dataset and Evaluation
47
+
48
+ - **Input Dataset**: Sample data from `sample_dataset.csv` containing balanced examples of 'Likely' and 'Unlikely' disinformation.
49
+ - **Labeling Criteria**: Text classified as "Likely" or "Unlikely" disinformation based on the presence of rhetorical techniques (e.g., exaggeration, emotional appeal).
50
+ - **Metrics**: Precision, recall, F1 score, and accuracy, computed with `sklearn.metrics`.
51
+
52
+ ### Model Performance
53
+
54
+
55
+ | Label | Precision | Recall | F1 Score |
56
+ |----------------|-----------|--------|----------|
57
+ | Unlikely (0) | 78% | 82% | 79.95% |
58
+ | Likely (1) | 81% | 85% | 82.95% |
59
+ | **Accuracy** | | | 87% |
60
+
61
+ ### Example Classification
62
+
63
+ ```plaintext
64
+ Example 1:
65
+ Text: "This new vaccine causes severe side effects in a majority of patients, which is something the authorities don’t want you to know."
66
+ Actual Label: Likely (1)
67
+ Model Prediction: Likely (1)
68
+ ```
69
+
70
+ ## Limitations and Future Work
71
+
72
+ - **False Positives**: May misclassify subjective statements lacking explicit disinformation techniques.
73
+ - **Inference Speed**: Optimization for deployment on different devices could improve real-time applicability.
74
+
75
+ ## Citation
76
+
77
+ If you use this model, please cite our work as follows:
78
+ ```
79
+ @inproceedings{Raza2024LlamaBiasClassifier,
80
+ title={Llama3.2 NLP Bias Classifier for Disinformation Detection},
81
+ author={Shaina Raza},
82
+ year={2024}
83
+ }
84
+ ```
85
+
86
+ For more information, see the model repository: [https://huggingface.co/POLLCHECK/Llama3.2-bias-classifier](https://huggingface.co/POLLCHECK/Llama3.2-bias-classifier)