azeddinShr commited on
Commit
eed1263
ยท
verified ยท
1 Parent(s): ac90ebd

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +25 -55
README.md CHANGED
@@ -8,7 +8,7 @@ tags:
8
  - rag
9
  - question-answering
10
  - fine-tuned
11
- - adalora
12
  - liquid
13
  - extractive-qa
14
  datasets:
@@ -21,19 +21,19 @@ library_name: transformers
21
  pipeline_tag: question-answering
22
  ---
23
 
24
- # LFM2-1.2B-RAG Arabic (AdaLoRA Fine-tuned)
25
 
26
- Fine-tuned version of [LiquidAI/LFM2-1.2B-RAG](https://huggingface.co/LiquidAI/LFM2-1.2B-RAG) for Arabic reading comprehension and question answering tasks using **AdaLoRA (Adaptive Low-Rank Adaptation)** technique.
27
 
28
  ## ๐Ÿ“‹ Model Description
29
 
30
- This model specializes in extractive question answering for Arabic text with adaptive parameter allocation. It has been fine-tuned on the Arabic Reading Comprehension Dataset (ARCD) using AdaLoRA, which dynamically adjusts the rank of different layers during training for optimal performance.
31
 
32
  **Key Features:**
33
- - Optimized for Arabic extractive QA with adaptive rank allocation
34
- - Context-based question answering with high faithfulness
35
- - Balanced performance across multiple evaluation metrics
36
- - Parameter-efficient fine-tuning via AdaLoRA
37
 
38
  ## ๐ŸŽฏ Intended Use
39
 
@@ -42,21 +42,19 @@ This model specializes in extractive question answering for Arabic text with ada
42
  - RAG (Retrieval-Augmented Generation) applications for Arabic content
43
  - Information extraction from Arabic documents
44
  - Educational tools for Arabic reading comprehension
45
- - Chatbots requiring grounded Arabic responses
46
 
47
  ### Downstream Use
48
  Can be further fine-tuned for:
49
  - Domain-specific QA (medical, legal, financial)
50
  - Multi-turn conversational QA
51
- - Cross-lingual QA systems
52
- - Document analysis pipelines
53
 
54
  ### Out-of-Scope Use
55
  **Not recommended for:**
56
  - Open-domain question answering without context
57
- - Creative writing or story generation
58
- - Machine translation
59
- - Code generation or technical programming tasks
60
 
61
  ## ๐Ÿš€ How to Use
62
 
@@ -67,7 +65,7 @@ import torch
67
  from transformers import AutoModelForCausalLM, AutoTokenizer
68
 
69
  # Load model and tokenizer
70
- model_id = "azeddinShr/LFM2-1.2B-RAG-ARABIC-AdaLoRA"
71
  model = AutoModelForCausalLM.from_pretrained(
72
  model_id,
73
  device_map="auto",
@@ -100,8 +98,8 @@ with torch.no_grad():
100
 
101
  answer = tokenizer.decode(outputs[0][input_ids.shape[1]:], skip_special_tokens=True)
102
  print(answer) # Output: 500 ู…ู„ูŠุงุฑ ุฏูˆู„ุงุฑ
103
- ```
104
 
 
105
 
106
  ## ๐Ÿ“Š Training Details
107
 
@@ -115,7 +113,7 @@ print(answer) # Output: 500 ู…ู„ูŠุงุฑ ุฏูˆู„ุงุฑ
115
 
116
  ### Training Procedure
117
 
118
- **Fine-tuning method:** AdaLoRA (Adaptive Low-Rank Adaptation)
119
 
120
  **Hyperparameters:**
121
  - **Base model:** LiquidAI/LFM2-1.2B-RAG
@@ -126,18 +124,9 @@ print(answer) # Output: 500 ู…ู„ูŠุงุฑ ุฏูˆู„ุงุฑ
126
  - **LR scheduler:** Cosine
127
  - **Warmup steps:** 50
128
  - **Weight decay:** 0.01
129
-
130
- **AdaLoRA Configuration:**
131
- - **Initial rank (r):** 16
132
- - **Target average rank:** 8
133
- - **Initial adapter rank:** 12
134
  - **LoRA alpha:** 32
135
  - **LoRA dropout:** 0.05
136
- - **Pruning start step (tinit):** 10% of total steps
137
- - **Pruning end step (tfinal):** 70% of total steps
138
- - **Pruning frequency (deltaT):** 10 steps
139
- - **Importance smoothing (beta1, beta2):** 0.85
140
- - **Orthogonality regularization:** 0.5
141
  - **Target modules:** w1, w2, w3, q_proj, k_proj, v_proj, out_proj, in_proj
142
 
143
  **Training infrastructure:**
@@ -145,38 +134,24 @@ print(answer) # Output: 500 ู…ู„ูŠุงุฑ ุฏูˆู„ุงุฑ
145
  - Gradient checkpointing: Enabled
146
  - Framework: Hugging Face Transformers + PEFT + TRL
147
 
148
- ## ๐Ÿ”’ Ethical Considerations
149
-
150
- - This model should not be used to generate misleading information or propaganda
151
- - Outputs should be fact-checked for critical applications
152
- - The model reflects statistical patterns in training data and may not represent complete or unbiased knowledge
153
- - Users are responsible for ensuring appropriate use in their applications
154
-
155
- ## ๐Ÿ”ฌ Technical Details
156
 
157
- ### What is AdaLoRA?
158
-
159
- AdaLoRA (Adaptive Low-Rank Adaptation) extends LoRA by dynamically allocating parameter budgets across different weight matrices based on their importance during training. This results in:
160
- - More efficient parameter usage
161
- - Better performance with fewer trainable parameters
162
- - Automatic pruning of less important adaptations
163
 
164
- ### Advantages over standard LoRA
165
- - Adaptive rank allocation based on importance scores
166
- - Better performance-efficiency trade-off
167
- - More stable training dynamics
168
 
169
  ## ๐Ÿ“œ Citation
170
 
171
  If you use this model in your research or application, please cite:
172
 
173
  ```bibtex
174
- @misc{lfm2-arabic-qa-adalora,
175
- author = {Azeddin Sahir},
176
- title = {LFM2-1.2B-RAG Arabic (AdaLoRA Fine-tuned)},
177
  year = {2025},
178
  publisher = {Hugging Face},
179
- howpublished = {\url{https://huggingface.co/azeddinShr/lfm2-1.2b-arabic-qa-adalora}}
180
  }
181
  ```
182
 
@@ -185,16 +160,11 @@ If you use this model in your research or application, please cite:
185
  - **Base Model:** [LiquidAI](https://www.liquid.ai/) for LFM2-1.2B-RAG
186
  - **Dataset:** [ARCD](https://huggingface.co/datasets/hsseinmz/arcd) - Arabic Reading Comprehension Dataset
187
  - **Framework:** Hugging Face Transformers, PEFT, TRL
188
- - **Method:** AdaLoRA by Zhang et al.
189
 
190
  ## ๐Ÿ“„ License
191
 
192
- Base model License
193
 
194
  ## ๐Ÿ“ง Contact
195
 
196
  For questions, issues, or collaboration opportunities, please open an issue in the model repository or contact via Hugging Face.
197
-
198
- ---
199
-
200
- **Note:** This is a research model. Always validate outputs for your specific use case and domain.
 
8
  - rag
9
  - question-answering
10
  - fine-tuned
11
+ - lora
12
  - liquid
13
  - extractive-qa
14
  datasets:
 
21
  pipeline_tag: question-answering
22
  ---
23
 
24
+ # LFM2-1.2B-RAG Arabic (LoRA Fine-tuned)
25
 
26
+ Fine-tuned version of [LiquidAI/LFM2-1.2B-RAG](https://huggingface.co/LiquidAI/LFM2-1.2B-RAG) for Arabic reading comprehension and question answering tasks using **LoRA (Low-Rank Adaptation)** technique.
27
 
28
  ## ๐Ÿ“‹ Model Description
29
 
30
+ This model specializes in extractive question answering for Arabic text. It has been fine-tuned using LoRA on the Arabic Reading Comprehension Dataset (ARCD) to improve its ability to answer questions based on provided context in Modern Standard Arabic.
31
 
32
  **Key Features:**
33
+ - Optimized for Arabic extractive QA
34
+ - Context-based question answering
35
+ - Maintains faithfulness to source documents
36
+ - Efficient fine-tuning via LoRA (rank=16)
37
 
38
  ## ๐ŸŽฏ Intended Use
39
 
 
42
  - RAG (Retrieval-Augmented Generation) applications for Arabic content
43
  - Information extraction from Arabic documents
44
  - Educational tools for Arabic reading comprehension
 
45
 
46
  ### Downstream Use
47
  Can be further fine-tuned for:
48
  - Domain-specific QA (medical, legal, financial)
49
  - Multi-turn conversational QA
50
+ - Document summarization with Q&A
 
51
 
52
  ### Out-of-Scope Use
53
  **Not recommended for:**
54
  - Open-domain question answering without context
55
+ - Creative writing or content generation
56
+ - Translation tasks
57
+ - Code generation
58
 
59
  ## ๐Ÿš€ How to Use
60
 
 
65
  from transformers import AutoModelForCausalLM, AutoTokenizer
66
 
67
  # Load model and tokenizer
68
+ model_id = "azeddinShr/LFM2-1.2B-RAG-ARABIC-LoRA"
69
  model = AutoModelForCausalLM.from_pretrained(
70
  model_id,
71
  device_map="auto",
 
98
 
99
  answer = tokenizer.decode(outputs[0][input_ids.shape[1]:], skip_special_tokens=True)
100
  print(answer) # Output: 500 ู…ู„ูŠุงุฑ ุฏูˆู„ุงุฑ
 
101
 
102
+ ```
103
 
104
  ## ๐Ÿ“Š Training Details
105
 
 
113
 
114
  ### Training Procedure
115
 
116
+ **Fine-tuning method:** LoRA (Low-Rank Adaptation)
117
 
118
  **Hyperparameters:**
119
  - **Base model:** LiquidAI/LFM2-1.2B-RAG
 
124
  - **LR scheduler:** Cosine
125
  - **Warmup steps:** 50
126
  - **Weight decay:** 0.01
127
+ - **LoRA rank (r):** 16
 
 
 
 
128
  - **LoRA alpha:** 32
129
  - **LoRA dropout:** 0.05
 
 
 
 
 
130
  - **Target modules:** w1, w2, w3, q_proj, k_proj, v_proj, out_proj, in_proj
131
 
132
  **Training infrastructure:**
 
134
  - Gradient checkpointing: Enabled
135
  - Framework: Hugging Face Transformers + PEFT + TRL
136
 
 
 
 
 
 
 
 
 
137
 
138
+ ## ๐Ÿ”’ Ethical Considerations
 
 
 
 
 
139
 
140
+ - This model should not be used for generating misleading or false information
141
+ - Users should verify factual claims, especially for sensitive topics
142
+ - The model's responses reflect patterns in training data and may not represent complete or unbiased information
 
143
 
144
  ## ๐Ÿ“œ Citation
145
 
146
  If you use this model in your research or application, please cite:
147
 
148
  ```bibtex
149
+ @misc{lfm2-rag-arabic-lora,
150
+ author = {Azeddin sahir},
151
+ title = {LFM2-1.2B-RAG Arabic (LoRA Fine-tuned)},
152
  year = {2025},
153
  publisher = {Hugging Face},
154
+ howpublished = {\url{https://huggingface.co/azeddinShr/lfm2-1.2b-arabic-qa-lora}}
155
  }
156
  ```
157
 
 
160
  - **Base Model:** [LiquidAI](https://www.liquid.ai/) for LFM2-1.2B-RAG
161
  - **Dataset:** [ARCD](https://huggingface.co/datasets/hsseinmz/arcd) - Arabic Reading Comprehension Dataset
162
  - **Framework:** Hugging Face Transformers, PEFT, TRL
 
163
 
164
  ## ๐Ÿ“„ License
165
 
166
+ Same as based model
167
 
168
  ## ๐Ÿ“ง Contact
169
 
170
  For questions, issues, or collaboration opportunities, please open an issue in the model repository or contact via Hugging Face.