lballore commited on
Commit
c86e92d
·
0 Parent(s):

Initial release of llimba-3b-instruct

Browse files
.gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Apache License 2.0
3
+ spdx-id: Apache-2.0
4
+ redirect_from: /licenses/apache/
5
+ featured: true
6
+ hidden: false
7
+
8
+ description: A permissive license whose main conditions require preservation of copyright and license notices. Contributors provide an express grant of patent rights. Licensed works, modifications, and larger works may be distributed under different terms and without source code.
9
+
10
+ how: Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file.
11
+
12
+ note: The Apache Software Foundation <a href="https://apache.org/foundation/license-faq.html#Apply-My-Software">recommends</a> taking the additional step of adding a boilerplate notice to the header of each source file. You can find the notice in the appendix at the very end of the license text.
13
+
14
+ using:
15
+ Kubernetes: https://github.com/kubernetes/kubernetes/blob/master/LICENSE
16
+ PDF.js: https://github.com/mozilla/pdf.js/blob/master/LICENSE
17
+ Swift: https://github.com/apple/swift/blob/main/LICENSE.txt
18
+
19
+ permissions:
20
+ - commercial-use
21
+ - modifications
22
+ - distribution
23
+ - patent-use
24
+ - private-use
25
+
26
+ conditions:
27
+ - include-copyright
28
+ - document-changes
29
+
30
+ limitations:
31
+ - trademark-use
32
+ - liability
33
+ - warranty
34
+
35
+ ---
36
+
37
+ Apache License
38
+ Version 2.0, January 2004
39
+ http://www.apache.org/licenses/
40
+
41
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
42
+
43
+ 1. Definitions.
44
+
45
+ "License" shall mean the terms and conditions for use, reproduction,
46
+ and distribution as defined by Sections 1 through 9 of this document.
47
+
48
+ "Licensor" shall mean the copyright owner or entity authorized by
49
+ the copyright owner that is granting the License.
50
+
51
+ "Legal Entity" shall mean the union of the acting entity and all
52
+ other entities that control, are controlled by, or are under common
53
+ control with that entity. For the purposes of this definition,
54
+ "control" means (i) the power, direct or indirect, to cause the
55
+ direction or management of such entity, whether by contract or
56
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
57
+ outstanding shares, or (iii) beneficial ownership of such entity.
58
+
59
+ "You" (or "Your") shall mean an individual or Legal Entity
60
+ exercising permissions granted by this License.
61
+
62
+ "Source" form shall mean the preferred form for making modifications,
63
+ including but not limited to software source code, documentation
64
+ source, and configuration files.
65
+
66
+ "Object" form shall mean any form resulting from mechanical
67
+ transformation or translation of a Source form, including but
68
+ not limited to compiled object code, generated documentation,
69
+ and conversions to other media types.
70
+
71
+ "Work" shall mean the work of authorship, whether in Source or
72
+ Object form, made available under the License, as indicated by a
73
+ copyright notice that is included in or attached to the work
74
+ (an example is provided in the Appendix below).
75
+
76
+ "Derivative Works" shall mean any work, whether in Source or Object
77
+ form, that is based on (or derived from) the Work and for which the
78
+ editorial revisions, annotations, elaborations, or other modifications
79
+ represent, as a whole, an original work of authorship. For the purposes
80
+ of this License, Derivative Works shall not include works that remain
81
+ separable from, or merely link (or bind by name) to the interfaces of,
82
+ the Work and Derivative Works thereof.
83
+
84
+ "Contribution" shall mean any work of authorship, including
85
+ the original version of the Work and any modifications or additions
86
+ to that Work or Derivative Works thereof, that is intentionally
87
+ submitted to Licensor for inclusion in the Work by the copyright owner
88
+ or by an individual or Legal Entity authorized to submit on behalf of
89
+ the copyright owner. For the purposes of this definition, "submitted"
90
+ means any form of electronic, verbal, or written communication sent
91
+ to the Licensor or its representatives, including but not limited to
92
+ communication on electronic mailing lists, source code control systems,
93
+ and issue tracking systems that are managed by, or on behalf of, the
94
+ Licensor for the purpose of discussing and improving the Work, but
95
+ excluding communication that is conspicuously marked or otherwise
96
+ designated in writing by the copyright owner as "Not a Contribution."
97
+
98
+ "Contributor" shall mean Licensor and any individual or Legal Entity
99
+ on behalf of whom a Contribution has been received by Licensor and
100
+ subsequently incorporated within the Work.
101
+
102
+ 2. Grant of Copyright License. Subject to the terms and conditions of
103
+ this License, each Contributor hereby grants to You a perpetual,
104
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
105
+ copyright license to reproduce, prepare Derivative Works of,
106
+ publicly display, publicly perform, sublicense, and distribute the
107
+ Work and such Derivative Works in Source or Object form.
108
+
109
+ 3. Grant of Patent License. Subject to the terms and conditions of
110
+ this License, each Contributor hereby grants to You a perpetual,
111
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
112
+ (except as stated in this section) patent license to make, have made,
113
+ use, offer to sell, sell, import, and otherwise transfer the Work,
114
+ where such license applies only to those patent claims licensable
115
+ by such Contributor that are necessarily infringed by their
116
+ Contribution(s) alone or by combination of their Contribution(s)
117
+ with the Work to which such Contribution(s) was submitted. If You
118
+ institute patent litigation against any entity (including a
119
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
120
+ or a Contribution incorporated within the Work constitutes direct
121
+ or contributory patent infringement, then any patent licenses
122
+ granted to You under this License for that Work shall terminate
123
+ as of the date such litigation is filed.
124
+
125
+ 4. Redistribution. You may reproduce and distribute copies of the
126
+ Work or Derivative Works thereof in any medium, with or without
127
+ modifications, and in Source or Object form, provided that You
128
+ meet the following conditions:
129
+
130
+ (a) You must give any other recipients of the Work or
131
+ Derivative Works a copy of this License; and
132
+
133
+ (b) You must cause any modified files to carry prominent notices
134
+ stating that You changed the files; and
135
+
136
+ (c) You must retain, in the Source form of any Derivative Works
137
+ that You distribute, all copyright, patent, trademark, and
138
+ attribution notices from the Source form of the Work,
139
+ excluding those notices that do not pertain to any part of
140
+ the Derivative Works; and
141
+
142
+ (d) If the Work includes a "NOTICE" text file as part of its
143
+ distribution, then any Derivative Works that You distribute must
144
+ include a readable copy of the attribution notices contained
145
+ within such NOTICE file, excluding those notices that do not
146
+ pertain to any part of the Derivative Works, in at least one
147
+ of the following places: within a NOTICE text file distributed
148
+ as part of the Derivative Works; within the Source form or
149
+ documentation, if provided along with the Derivative Works; or,
150
+ within a display generated by the Derivative Works, if and
151
+ wherever such third-party notices normally appear. The contents
152
+ of the NOTICE file are for informational purposes only and
153
+ do not modify the License. You may add Your own attribution
154
+ notices within Derivative Works that You distribute, alongside
155
+ or as an addendum to the NOTICE text from the Work, provided
156
+ that such additional attribution notices cannot be construed
157
+ as modifying the License.
158
+
159
+ You may add Your own copyright statement to Your modifications and
160
+ may provide additional or different license terms and conditions
161
+ for use, reproduction, or distribution of Your modifications, or
162
+ for any such Derivative Works as a whole, provided Your use,
163
+ reproduction, and distribution of the Work otherwise complies with
164
+ the conditions stated in this License.
165
+
166
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
167
+ any Contribution intentionally submitted for inclusion in the Work
168
+ by You to the Licensor shall be under the terms and conditions of
169
+ this License, without any additional terms or conditions.
170
+ Notwithstanding the above, nothing herein shall supersede or modify
171
+ the terms of any separate license agreement you may have executed
172
+ with Licensor regarding such Contributions.
173
+
174
+ 6. Trademarks. This License does not grant permission to use the trade
175
+ names, trademarks, service marks, or product names of the Licensor,
176
+ except as required for reasonable and customary use in describing the
177
+ origin of the Work and reproducing the content of the NOTICE file.
178
+
179
+ 7. Disclaimer of Warranty. Unless required by applicable law or
180
+ agreed to in writing, Licensor provides the Work (and each
181
+ Contributor provides its Contributions) on an "AS IS" BASIS,
182
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
183
+ implied, including, without limitation, any warranties or conditions
184
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
185
+ PARTICULAR PURPOSE. You are solely responsible for determining the
186
+ appropriateness of using or redistributing the Work and assume any
187
+ risks associated with Your exercise of permissions under this License.
188
+
189
+ 8. Limitation of Liability. In no event and under no legal theory,
190
+ whether in tort (including negligence), contract, or otherwise,
191
+ unless required by applicable law (such as deliberate and grossly
192
+ negligent acts) or agreed to in writing, shall any Contributor be
193
+ liable to You for damages, including any direct, indirect, special,
194
+ incidental, or consequential damages of any character arising as a
195
+ result of this License or out of the use or inability to use the
196
+ Work (including but not limited to damages for loss of goodwill,
197
+ work stoppage, computer failure or malfunction, or any and all
198
+ other commercial damages or losses), even if such Contributor
199
+ has been advised of the possibility of such damages.
200
+
201
+ 9. Accepting Warranty or Additional Liability. While redistributing
202
+ the Work or Derivative Works thereof, You may choose to offer,
203
+ and charge a fee for, acceptance of support, warranty, indemnity,
204
+ or other liability obligations and/or rights consistent with this
205
+ License. However, in accepting such obligations, You may act only
206
+ on Your own behalf and on Your sole responsibility, not on behalf
207
+ of any other Contributor, and only if You agree to indemnify,
208
+ defend, and hold each Contributor harmless for any liability
209
+ incurred by, or claims asserted against, such Contributor by reason
210
+ of your accepting any such warranty or additional liability.
211
+
212
+ END OF TERMS AND CONDITIONS
213
+
214
+ APPENDIX: How to apply the Apache License to your work.
215
+
216
+ To apply the Apache License to your work, attach the following
217
+ boilerplate notice, with the fields enclosed by brackets "[]"
218
+ replaced with your own identifying information. (Don't include
219
+ the brackets!) The text should be enclosed in the appropriate
220
+ comment syntax for the file format. We also recommend that a
221
+ file or class name and description of purpose be included on the
222
+ same "printed page" as the copyright notice for easier
223
+ identification within third-party archives.
224
+
225
+ Copyright [yyyy] [name of copyright owner]
226
+
227
+ Licensed under the Apache License, Version 2.0 (the "License");
228
+ you may not use this file except in compliance with the License.
229
+ You may obtain a copy of the License at
230
+
231
+ http://www.apache.org/licenses/LICENSE-2.0
232
+
233
+ Unless required by applicable law or agreed to in writing, software
234
+ distributed under the License is distributed on an "AS IS" BASIS,
235
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
236
+ See the License for the specific language governing permissions and
237
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - srd
5
+ - en
6
+ - zh
7
+ - fr
8
+ - es
9
+ - pt
10
+ - de
11
+ - it
12
+ - ru
13
+ - ja
14
+ - ko
15
+ - vi
16
+ - th
17
+ - ar
18
+ library_name: transformers
19
+ pipeline_tag: text-generation
20
+ base_model: lballore/llimba-3b-instruct-cpt
21
+ base_model_relation: finetune
22
+ datasets:
23
+ - lballore/llimba-corpus
24
+ - lballore/llimba-sft
25
+ - lballore/llimba-flores-srd-eval
26
+ - facebook/flores
27
+ tags:
28
+ - sardinian
29
+ - limba-sarda-comuna
30
+ - lsc
31
+ - logudorese
32
+ - campidanese
33
+ - low-resource
34
+ - endangered-language
35
+ - romance
36
+ - multilingual
37
+ - qwen2.5
38
+ - continued-pretraining
39
+ - rslora
40
+ - sft
41
+ - text-generation-inference
42
+ model-index:
43
+ - name: llimba-3b-instruct
44
+ results:
45
+ - task:
46
+ type: translation
47
+ dataset:
48
+ name: FLORES-200 (Sardinian subset, 997 sentences)
49
+ type: facebook/flores
50
+ metrics:
51
+ - type: bleu
52
+ value: 28.47
53
+ name: EN-SC BLEU
54
+ - type: chrf
55
+ value: 56.80
56
+ name: EN-SC chrF
57
+ - type: bleu
58
+ value: 21.25
59
+ name: IT-SC BLEU
60
+ - type: chrf
61
+ value: 52.08
62
+ name: IT-SC chrF
63
+ - type: bleu
64
+ value: 18.57
65
+ name: ES-SC BLEU
66
+ - type: chrf
67
+ value: 49.41
68
+ name: ES-SC chrF
69
+ - type: bleu
70
+ value: 41.28
71
+ name: SC-EN BLEU
72
+ - type: chrf
73
+ value: 64.64
74
+ name: SC-EN chrF
75
+ - type: bleu
76
+ value: 17.61
77
+ name: SC-IT BLEU
78
+ - type: chrf
79
+ value: 47.25
80
+ name: SC-IT chrF
81
+ - type: bleu
82
+ value: 18.57
83
+ name: SC-ES BLEU
84
+ - type: chrf
85
+ value: 46.27
86
+ name: SC-ES chrF
87
+ co2_eq_emissions:
88
+ emissions: 0.3
89
+ source: estimated from RTX 4090 TDP and wall-clock training time
90
+ training_type: continued-pretraining + supervised-fine-tuning
91
+ geographical_location: Sweden
92
+ hardware_used: 1x NVIDIA RTX 4090 (24GB)
93
+ ---
94
+
95
+ # LLiMba-3B-Instruct
96
+
97
+ LLiMba-3B-Instruct is a Sardinian-capable extension of [Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct). It speaks fluent Sardinian (LSC, the standardized written form, with Logudorese and Campidanese accepted as input) and retains the multilingual capabilities of the base model across the languages Qwen2.5 supports. The full adaptation pipeline runs on a single 24GB consumer GPU.
98
+
99
+ Sardinian is a Romance language with roughly one million speakers, classified as endangered by UNESCO. Commercial translation services do not support it, and major LLMs do not produce it reliably. LLiMba is, to our knowledge, the first openly released LLM that can hold a Sardinian conversation, translate to and from Sardinian, and analyze Sardinian text.
100
+
101
+ This is the deployable model. For the post-CPT intermediate checkpoint (a research artifact useful only for re-running supervised fine-tuning with alternative recipes), see [lballore/llimba-3b-instruct-cpt](https://huggingface.co/lballore/llimba-3b-instruct-cpt).
102
+
103
+ 🎮 **Try it live:** [lballore-llimba-demo.hf.space](https://lballore-llimba-demo.hf.space/) - interactive Gradio chat with both conversational and translation modes. No installation required.
104
+
105
+ 📖 **Read the paper:** [LLiMba: Sardinian on a Single GPU](https://arxiv.org/abs/2605.09015)
106
+
107
+ *Not to be confused with the 2024 University of Cagliari paper LIMBA: An Open-Source Framework for the Preservation and Valorization of Low-Resource Languages using Generative Models (arXiv:2411.13453), which uses Sardinian as one of several case studies for a broader framework. Different acronym, independent project.*
108
+
109
+ ## Quick start
110
+
111
+ ```python
112
+ from transformers import pipeline
113
+
114
+ pipe = pipeline(
115
+ "text-generation",
116
+ model="lballore/llimba-3b-instruct",
117
+ torch_dtype="auto",
118
+ device_map="auto",
119
+ )
120
+
121
+ messages = [
122
+ {"role": "system", "content": "Ses unu assistente chi chistionat in sardu."},
123
+ {"role": "user", "content": "Salude! Comente ìstas?"},
124
+ ]
125
+
126
+ out = pipe(messages, max_new_tokens=200, do_sample=False)
127
+ print(out[0]["generated_text"][-1]["content"])
128
+ # Bene, gràtzias. E tue comente ìstas?
129
+ ```
130
+
131
+ For translation, change the system prompt:
132
+
133
+ ```python
134
+ messages = [
135
+ {"role": "system", "content": "Tue ses unu tradutore espertu in limba sarda LSC."},
136
+ {"role": "user", "content": "Translate to Sardinian: «The weather is rough today.»"},
137
+ ]
138
+ out = pipe(messages, max_new_tokens=200, do_sample=False)
139
+ ```
140
+
141
+ ## Recommended inference parameters
142
+
143
+ LLiMba ships with `do_sample=False` (greedy decoding) as the default. This produces deterministic, high-quality output for translation, factual Q&A, and short conversations, and is what the published FLORES benchmark numbers were measured with.
144
+
145
+ For other use cases, override the defaults at call time:
146
+
147
+ | Use case | Settings |
148
+ |---|---|
149
+ | Translation, factual Q&A | `do_sample=False` (default) |
150
+ | Conversational chat | `temperature=0.3, top_p=0.9, top_k=40, repetition_penalty=1.05` |
151
+ | Creative or long-form generation | `temperature=0.7, top_p=0.9, top_k=40, repetition_penalty=1.1` |
152
+
153
+ Temperatures above 0.7 can produce occasional language-boundary drift (Sardinian to Italian) and amplify the morphological hallucination described in Limitations on long open-ended prompts. The model was trained with Romance replay data specifically to mitigate this, but the safe upper bound for production deployments is around 0.7.
154
+
155
+ ## Languages
156
+
157
+ LLiMba inherits Qwen2.5's multilingual coverage and adds Sardinian. The Qwen2.5 documentation explicitly names Chinese, English, French, Spanish, Portuguese, German, Italian, Russian, Japanese, Korean, Vietnamese, Thai, and Arabic as supported, with broader coverage beyond that list. Continued pretraining on Sardinian was paired with roughly 2.4M tokens of Italian, Spanish, Portuguese, and Catalan replay data to limit forgetting on the Romance branch closest to Sardinian.
158
+
159
+ For Sardinian, the primary output target is LSC (Limba Sarda Comuna), the standardized written form codified by the Regione Autonoma della Sardegna in 2006. The training corpus includes Logudorese and Campidanese material, so the model accepts dialectal input gracefully but tends to produce LSC in its outputs.
160
+
161
+ We did not run multilingual benchmarks on non-Romance languages after adaptation. Users relying on the model for languages such as Japanese or Arabic should validate on their own task before deploying.
162
+
163
+ ## Translation results
164
+
165
+ Evaluated on 997 parallel sentences from FLORES-200 using lm-evaluation-harness 0.4.11 with greedy decoding.
166
+
167
+ | Direction | Base BLEU | LLiMba BLEU | Base chrF | LLiMba chrF |
168
+ |---|---:|---:|---:|---:|
169
+ | EN to SC | 2.75 | **28.47** | 27.41 | **56.80** |
170
+ | IT to SC | 2.16 | **21.25** | 27.52 | **52.08** |
171
+ | ES to SC | 1.99 | **18.57** | 26.39 | **49.41** |
172
+ | SC to EN | 11.73 | **41.28** | 44.55 | **64.64** |
173
+ | SC to IT | 2.90 | **17.61** | 33.38 | **47.25** |
174
+ | SC to ES | 5.67 | **18.57** | 36.98 | **46.27** |
175
+
176
+ The strong SC to EN baseline (BLEU 41.28) is itself evidence that English generation survives adaptation: the base model already knew English, continued pretraining added Sardinian comprehension, and the combination yields high-quality translation out of Sardinian without specifically training for it.
177
+
178
+ ## Qualitative behavior
179
+
180
+ On focused factual queries about Sardinian topics, LLiMba produces verifiable answers when the underlying facts are present in the training data. Asked "Chie fiat Gigi Riva?" (Who was Gigi Riva?), it correctly identifies him as the Italian footballer born in Leggiuno in 1944, who joined Cagliari in 1963, won the 1969-70 Serie A title, scored 35 goals in 42 appearances for the national team, was nicknamed "Rombo de Tronu" by Gianni Brera, and died in 2024.
181
+
182
+ On *cantu a tenore*, the polyphonic vocal tradition of central Sardinia, it correctly names the four voices (*boghe*, *bassu*, *contra*, *mesu boghe*), the 2005 UNESCO recognition, and the Barbagia origin.
183
+
184
+ Conversational greetings, short translations, factual recall on canonical Sardinian topics, and grammatical analysis all work well. Long open-ended generation is more variable; see Limitations.
185
+
186
+ ## Training procedure
187
+
188
+ **Base model.** Qwen2.5-3B-Instruct (3.09B parameters, transformer decoder, 32 layers, 16 attention heads, RoPE positional embeddings, 128K context length).
189
+
190
+ **Stage 1, continued pretraining.** Full fine-tuning in bfloat16 for 2 epochs on approximately 13.9M tokens (11.5M Sardinian plus 2.4M Romance replay drawn from Italian, Spanish, Portuguese, and Catalan Wikipedias). Sequence length 4096. Effective batch 16 (1 per device with 16 gradient accumulation steps). Learning rate 5e-5 with cosine schedule and 50-step warmup. Paged AdamW 8-bit optimizer. Flash Attention 2. Gradient checkpointing enabled. Sequence packing disabled (packing leaks attention across document boundaries within a packed sequence and degraded model quality in our preliminary runs). Wall-clock time: 5.5 hours on one RTX 4090.
191
+
192
+ **Stage 2, supervised fine-tuning.** rsLoRA adapter at rank 256, alpha 256, dropout 0.05, targeting q, k, v, o, gate, up, and down projection matrices. 2 epochs on 14,404 instruction pairs (~12.8M tokens) with completion-only loss. Learning rate 2e-5 with cosine schedule and 50-step warmup. Other hyperparameters match Stage 1. The rsLoRA scaling correction (alpha/sqrt(r)) is what makes rank 256 trainable in practice; conventional LoRA scaling at this rank causes gradient collapse.
193
+
194
+ The released weights have the rsLoRA adapter merged into the base. Full training scripts, data preparation pipeline, and evaluation harness are at [github.com/lballore/LLiMba](https://github.com/lballore/LLiMba).
195
+
196
+ ## Intended use
197
+
198
+ Research, education, language preservation, and personal use by speakers and learners of Sardinian. Specific use cases include conversational practice, translation between Sardinian and other Romance languages or English, language learning, text analysis, and as a starting point for further Sardinian NLP research.
199
+
200
+ ## Limitations
201
+
202
+ **Hallucination on out-of-training facts.** Like all 3B-class models, LLiMba fabricates when queried on content not present in training. The pattern is strongest for biographical specifics about partially-known figures: confident wrong dates, invented nicknames, plausible-sounding but false claims. Treat factual outputs with appropriate skepticism.
203
+
204
+ **Morphological hallucination on long open-ended prompts.** On extended unconstrained generation about Sardinian culture, the model occasionally produces phonotactically valid but non-attested Sardinian words (for example, *cungafròngias*, *mojgas*). The lexical resources for clean generation are present; the same model produces attested vocabulary on focused, structured queries. Mitigation: prefer structured prompts ("List the three main causes, one short sentence each") over open-ended ones ("Tell me about X") for production deployments.
205
+
206
+ **Dialect skew.** The model targets LSC and was reviewed by a single native speaker of the Nuorese variant. Logudorese and Campidanese input is handled, but speakers of those variants may find the model's output skews toward the standardized form rather than their local register.
207
+
208
+ **Multilingual capability not benchmarked end-to-end.** Continued pretraining can degrade non-target language capabilities. Romance replay data mitigates this for Italian, Spanish, Portuguese, and Catalan, and the strong SC to EN scores suggest English is well preserved, but other languages were not benchmarked after adaptation. Validate on your own task before relying on these.
209
+
210
+ **Training data caveats.** The pretraining corpus includes Sardinian translations of literary works whose copyright status was not exhaustively verified, so the corpus is not redistributed in raw form (the data collection pipeline and source pointers are released instead). The supervised fine-tuning data includes machine-translated Capybara entries (NLLB-200 3.3B as translator) which contain residual Italian-shaped grammatical structures rendered with Sardinian vocabulary.
211
+
212
+ ## Feedback and contributions
213
+
214
+ Bug reports, feature requests, native-speaker feedback on outputs, and any other discussion happens on **[GitHub](https://github.com/lballore/LLiMba/issues)**. The Hugging Face Community tab on this repository is intentionally disabled to keep all conversation in one place.
215
+
216
+ If you're a Sardinian speaker spotting bad output, an incorrect dialect, or vocabulary the model is missing, an issue with the prompt and the response is genuinely useful and contributions of any size are welcome.
217
+
218
+ ## Out-of-scope use
219
+
220
+ The model is not suitable for high-stakes factual queries, medical or legal advice, or any application where hallucination would cause material harm. It should not be used as a sole authoritative source for Sardinian language standardization or pedagogy without human review.
221
+
222
+ ## License
223
+
224
+ Model weights are released under the **Apache 2.0** license. See [LICENSE](./LICENSE) for full terms.
225
+
226
+ The training and evaluation code at [github.com/lballore/LLiMba](https://github.com/lballore/LLiMba) is independently released also under Apache 2.0.
227
+
228
+ ## Acknowledgements
229
+
230
+ Native speaker review for the corpus and supervised fine-tuning data was contributed by the author. Source web texts come from salimbasarda.net, istorias.it, sardumatica.net, limbasardasudsardigna.it, and lacanas.it. Sardinian Wikipedia editors, and the Sardinian community of writers and translators made this project possible.
231
+
232
+ ## Citation
233
+
234
+ ```bibtex
235
+ @misc{llimba2026,
236
+ title = {LLiMba: Sardinian on a Single GPU - Adapting a 3B Language Model to a Vanishing Romance Language},
237
+ author = {Luca Ballore},
238
+ year = {2026},
239
+ eprint = {2605.09015},
240
+ archivePrefix = {arXiv},
241
+ primaryClass = {cs.CL},
242
+ url = {https://arxiv.org/abs/2605.09015}
243
+ }
244
+
245
+ @misc{llimba-3b-instruct,
246
+ title = {LLiMba-3B-Instruct},
247
+ author = {Luca Ballore},
248
+ year = {2026},
249
+ publisher = {Hugging Face},
250
+ url = {https://huggingface.co/lballore/llimba-3b-instruct}
251
+ }
252
+ ```
chat_template.jinja ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0]['role'] == 'system' %}
4
+ {{- messages[0]['content'] }}
5
+ {%- else %}
6
+ {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}
7
+ {%- endif %}
8
+ {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
9
+ {%- for tool in tools %}
10
+ {{- "\n" }}
11
+ {{- tool | tojson }}
12
+ {%- endfor %}
13
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
14
+ {%- else %}
15
+ {%- if messages[0]['role'] == 'system' %}
16
+ {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
17
+ {%- else %}
18
+ {{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }}
19
+ {%- endif %}
20
+ {%- endif %}
21
+ {%- for message in messages %}
22
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
23
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
24
+ {%- elif message.role == "assistant" %}
25
+ {{- '<|im_start|>' + message.role }}
26
+ {%- if message.content %}
27
+ {{- '\n' + message.content }}
28
+ {%- endif %}
29
+ {%- for tool_call in message.tool_calls %}
30
+ {%- if tool_call.function is defined %}
31
+ {%- set tool_call = tool_call.function %}
32
+ {%- endif %}
33
+ {{- '\n<tool_call>\n{"name": "' }}
34
+ {{- tool_call.name }}
35
+ {{- '", "arguments": ' }}
36
+ {{- tool_call.arguments | tojson }}
37
+ {{- '}\n</tool_call>' }}
38
+ {%- endfor %}
39
+ {{- '<|im_end|>\n' }}
40
+ {%- elif message.role == "tool" %}
41
+ {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
42
+ {{- '<|im_start|>user' }}
43
+ {%- endif %}
44
+ {{- '\n<tool_response>\n' }}
45
+ {{- message.content }}
46
+ {{- '\n</tool_response>' }}
47
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
48
+ {{- '<|im_end|>\n' }}
49
+ {%- endif %}
50
+ {%- endif %}
51
+ {%- endfor %}
52
+ {%- if add_generation_prompt %}
53
+ {{- '<|im_start|>assistant\n' }}
54
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen2ForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "bos_token_id": null,
7
+ "dtype": "bfloat16",
8
+ "eos_token_id": 151645,
9
+ "hidden_act": "silu",
10
+ "hidden_size": 2048,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 11008,
13
+ "layer_types": [
14
+ "full_attention",
15
+ "full_attention",
16
+ "full_attention",
17
+ "full_attention",
18
+ "full_attention",
19
+ "full_attention",
20
+ "full_attention",
21
+ "full_attention",
22
+ "full_attention",
23
+ "full_attention",
24
+ "full_attention",
25
+ "full_attention",
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention",
43
+ "full_attention",
44
+ "full_attention",
45
+ "full_attention",
46
+ "full_attention",
47
+ "full_attention",
48
+ "full_attention",
49
+ "full_attention"
50
+ ],
51
+ "max_position_embeddings": 32768,
52
+ "max_window_layers": 70,
53
+ "model_type": "qwen2",
54
+ "num_attention_heads": 16,
55
+ "num_hidden_layers": 36,
56
+ "num_key_value_heads": 2,
57
+ "pad_token_id": 151643,
58
+ "rms_norm_eps": 1e-06,
59
+ "rope_parameters": {
60
+ "rope_theta": 1000000.0,
61
+ "rope_type": "default"
62
+ },
63
+ "sliding_window": null,
64
+ "tie_word_embeddings": true,
65
+ "transformers_version": "5.3.0",
66
+ "use_cache": false,
67
+ "use_sliding_window": false,
68
+ "vocab_size": 151936
69
+ }
generation_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_sample": false,
3
+ "eos_token_id": [
4
+ 151645,
5
+ 151643
6
+ ],
7
+ "pad_token_id": 151643,
8
+ "repetition_penalty": 1.0,
9
+ "temperature": 1.0,
10
+ "top_k": 50,
11
+ "top_p": 1.0,
12
+ "transformers_version": "5.3.0"
13
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1279de1a2a43308a55292058fdf9d0183b9af60f7b4cc5cbbbca590d7d6382ab
3
+ size 6171927112
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3fd169731d2cbde95e10bf356d66d5997fd885dd8dbb6fb4684da3f23b2585d8
3
+ size 11421892
tokenizer_config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<|im_start|>",
10
+ "<|im_end|>",
11
+ "<|object_ref_start|>",
12
+ "<|object_ref_end|>",
13
+ "<|box_start|>",
14
+ "<|box_end|>",
15
+ "<|quad_start|>",
16
+ "<|quad_end|>",
17
+ "<|vision_start|>",
18
+ "<|vision_end|>",
19
+ "<|vision_pad|>",
20
+ "<|image_pad|>",
21
+ "<|video_pad|>"
22
+ ],
23
+ "is_local": true,
24
+ "model_max_length": 131072,
25
+ "pad_token": "<|endoftext|>",
26
+ "split_special_tokens": false,
27
+ "tokenizer_class": "Qwen2Tokenizer",
28
+ "unk_token": null
29
+ }
training_config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "base_model": "/workspaces/LLiMba/models/cpt-pretrain-qwen2.5-3b",
3
+ "dataset": "/workspaces/LLiMba/data/curated/sft/sft_dataset.jsonl",
4
+ "mode": "lora",
5
+ "rank": 256,
6
+ "alpha": 256,
7
+ "dropout": 0.05,
8
+ "target_modules": [
9
+ "q_proj",
10
+ "k_proj",
11
+ "v_proj",
12
+ "o_proj",
13
+ "gate_proj",
14
+ "up_proj",
15
+ "down_proj"
16
+ ],
17
+ "lr": 2e-05,
18
+ "epochs": 2,
19
+ "batch_size": 1,
20
+ "grad_accum": 16,
21
+ "effective_batch": 16,
22
+ "max_length": 4096,
23
+ "warmup_steps": 50,
24
+ "attention": "flash_attention_2",
25
+ "eval_split": 0.05,
26
+ "train_loss": 0.867611675270807,
27
+ "eval_loss": null,
28
+ "train_samples": 13683,
29
+ "eval_samples": 721
30
+ }