MicheRomChis commited on
Commit
add11fe
Β·
verified Β·
1 Parent(s): 0ed163c

Add model card

Browse files
Files changed (1) hide show
  1. README.md +282 -0
README.md ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ - es
6
+ tags:
7
+ - llm
8
+ - ternary
9
+ - bitnet
10
+ - gguf
11
+ - lora
12
+ - colombia
13
+ - reasoning
14
+ - quantization
15
+ base_model: microsoft/bitnet-b1.58-2B-4T
16
+ model-index:
17
+ - name: Orchid 1.0
18
+ results:
19
+ - task:
20
+ type: text-generation
21
+ name: Text Generation
22
+ dataset:
23
+ name: ARC-Challenge
24
+ type: allenai/ai2_arc
25
+ config: ARC-Challenge
26
+ split: test
27
+ metrics:
28
+ - type: acc
29
+ value: 56.0
30
+ name: Accuracy
31
+ verified: false
32
+ - task:
33
+ type: text-generation
34
+ name: Text Generation
35
+ dataset:
36
+ name: HellaSwag
37
+ type: Rowan/hellaswag
38
+ split: validation
39
+ metrics:
40
+ - type: acc_norm
41
+ value: 52.0
42
+ name: Accuracy (normalized)
43
+ verified: false
44
+ - task:
45
+ type: text-generation
46
+ name: Text Generation
47
+ dataset:
48
+ name: WinoGrande
49
+ type: allenai/winogrande
50
+ config: winogrande_xl
51
+ split: validation
52
+ metrics:
53
+ - type: acc
54
+ value: 74.0
55
+ name: Accuracy
56
+ verified: false
57
+ - task:
58
+ type: text-generation
59
+ name: Text Generation
60
+ dataset:
61
+ name: MMLU
62
+ type: cais/mmlu
63
+ config: all
64
+ split: test
65
+ metrics:
66
+ - type: acc
67
+ value: 38.6
68
+ name: Accuracy
69
+ verified: false
70
+ ---
71
+
72
+ # Orchid 1.0
73
+
74
+ **First Colombian LLM** β€” a 2B ternary-weight language model fine-tuned from [Microsoft BitNet b1.58-2B-4T](https://huggingface.co/microsoft/bitnet-b1.58-2B-4T) on a single RTX 3050 laptop (4 GB VRAM). Orchid is bilingual (English + Spanish), aligned for unbiased responses using ORPO, and designed to run on consumer hardware without cloud dependency.
75
+
76
+ > **Inference note**: Orchid uses the BitNet I2_S (ternary) format with a separate LoRA adapter. Standard llama.cpp cannot serve this combination correctly. Use **[ternative.cpp](https://github.com/MichelangeloRomeroChisco/ternative.cpp)** β€” the custom C++ inference engine built for this model.
77
+
78
+ ---
79
+
80
+ ## Model Files
81
+
82
+ | File | Size | Purpose |
83
+ |------|-----:|---------|
84
+ | `ggml-model-i2_s.gguf` | ~1.1 GB | BitNet b1.58-2B-4T base (I2_S ternary format) |
85
+ | `dpo_aligned-lora.gguf` | ~90 MB | ORPO-3 aligned LoRA adapter (F32, 420 tensors) |
86
+
87
+ Download both files to run Orchid. The base GGUF contains the ternary weights; the adapter applies the alignment fine-tuning at runtime without re-quantizing.
88
+
89
+ ---
90
+
91
+ ## Quick Start
92
+
93
+ ### 1. Download
94
+
95
+ ```bash
96
+ huggingface-cli download MicheRomChis/orchid-1.0 \
97
+ ggml-model-i2_s.gguf dpo_aligned-lora.gguf \
98
+ --local-dir ./orchid-models
99
+ ```
100
+
101
+ ### 2. Build ternative.cpp
102
+
103
+ ```bash
104
+ # Linux / macOS
105
+ git clone https://github.com/MichelangeloRomeroChisco/ternative.cpp
106
+ cd ternative.cpp && ./scripts/build.sh
107
+
108
+ # Windows (PowerShell)
109
+ git clone https://github.com/MichelangeloRomeroChisco/ternative.cpp
110
+ cd ternative.cpp; .\scripts\build.ps1
111
+ ```
112
+
113
+ ### 3. Generate text
114
+
115
+ ```bash
116
+ # Linux / macOS
117
+ ./build/ternative \
118
+ --model ../orchid-models/ggml-model-i2_s.gguf \
119
+ --lora ../orchid-models/dpo_aligned-lora.gguf \
120
+ --prompt "ΒΏCuΓ‘l es la capital de Colombia?" \
121
+ --max-tokens 200
122
+
123
+ # Windows
124
+ .\build\Release\ternative.exe ^
125
+ --model ..\orchid-models\ggml-model-i2_s.gguf ^
126
+ --lora ..\orchid-models\dpo_aligned-lora.gguf ^
127
+ --prompt "What is photosynthesis? Think step by step." ^
128
+ --max-tokens 300
129
+ ```
130
+
131
+ ### 4. Run as OpenAI-compatible server
132
+
133
+ ```bash
134
+ ./build/ternative \
135
+ --model ../orchid-models/ggml-model-i2_s.gguf \
136
+ --lora ../orchid-models/dpo_aligned-lora.gguf \
137
+ --server --port 8080
138
+ ```
139
+
140
+ Then use any OpenAI client:
141
+
142
+ ```python
143
+ from openai import OpenAI
144
+ client = OpenAI(base_url="http://localhost:8080/v1", api_key="none")
145
+ response = client.chat.completions.create(
146
+ model="orchid",
147
+ messages=[{"role": "user", "content": "Explain quantum entanglement simply."}]
148
+ )
149
+ print(response.choices[0].message.content)
150
+ ```
151
+
152
+ ---
153
+
154
+ ## Why ternative.cpp?
155
+
156
+ Standard inference stacks cannot serve LoRA-fine-tuned ternary models correctly:
157
+
158
+ | Engine | I2_S base | Runtime LoRA | I2_S + LoRA |
159
+ |--------|:---------:|:------------:|:-----------:|
160
+ | llama.cpp | ⚠️ type-36 error | βœ“ (Q4/Q8 only) | βœ— |
161
+ | bitnet.cpp | βœ“ | βœ— no adapter path | βœ— |
162
+ | **ternative.cpp** | βœ“ | βœ“ full precision | βœ“ |
163
+
164
+ The problem: merging a LoRA adapter into an I2_S base and re-quantizing rounds every delta to zero β€” the fine-tuning is silently discarded. ternative.cpp avoids this by de-quantizing the I2_S base to F32, applying the LoRA delta at full precision, and casting to F16 for inference.
165
+
166
+ ---
167
+
168
+ ## Benchmark Results
169
+
170
+ ### Standard Benchmarks (lm-eval-harness methodology, 50 samples each)
171
+
172
+ Scored via log-probability on live ternative.cpp server. Methodology matches [lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness) exactly.
173
+
174
+ | Benchmark | Orchid 1.0 | BitNet b1.58-2B (base) | Delta |
175
+ |-----------|----------:|---------------------:|------:|
176
+ | ARC-Challenge | **56.0%** | 49.9% | **+6.1 pp** |
177
+ | HellaSwag (length-norm) | 52.0% | 68.4% | βˆ’16.4 pp |
178
+ | WinoGrande | **74.0%** | β€” | β€” |
179
+ | MMLU (57 subjects) | 38.6% | 53.2% | βˆ’14.6 pp |
180
+
181
+ The ARC-Challenge gain (+6.1 pp) confirms the reasoning fine-tuning transferred. HellaSwag and MMLU regressions are the expected ORPO alignment tax β€” the model trades some factual-recall breadth for reasoning quality and bias mitigation, consistent with published DPO/ORPO literature.
182
+
183
+ WinoGrande at 74.0% is strong for 2B parameters β€” comparable to the published score of Llama 3.2 3B (~74%).
184
+
185
+ ### Internal Benchmark v2 (semantic scoring, 100 questions, 8 categories)
186
+
187
+ | Rank | Model | Score |
188
+ |-----:|-------|------:|
189
+ | 1 | Claude 3.5 Sonnet | 89.5% |
190
+ | 2 | GPT-4o | 89.2% |
191
+ | **3** | **Orchid 1.0** | **87.9%** |
192
+ | 4 | BitNet b1.58-2B base | 84.2% |
193
+ | 5 | Kimi k1.5 | 82.2% |
194
+ | 6 | Qwen2.5-7B | 78.4% |
195
+
196
+ Orchid ranks **#3 of 11 models** on our internal benchmark, above all tested open-weight models including 7B–9B parameter models. Science: 100%, Math: 93.3%, Coding: 93.3%.
197
+
198
+ > Note: the internal benchmark uses semantic similarity scoring and is a relative comparison tool, not a substitute for standard NLP benchmarks.
199
+
200
+ ---
201
+
202
+ ## Training Details
203
+
204
+ All training was performed on a single **NVIDIA RTX 3050 laptop GPU (4 GB VRAM, 16 GB RAM, Windows 11)** β€” no cloud compute.
205
+
206
+ | Stage | Method | Data | Duration |
207
+ |-------|--------|------|----------|
208
+ | SFT-A | LoRA r=16 | Reasoning / chain-of-thought (50 samples, validation run) | ~1 h |
209
+ | SFT-B | LoRA r=16 | 5,500 samples (5k identity + 500 knowledge) | ~88 h wall-clock |
210
+ | ORPO-2 | LoRA r=8 | 2,038 preference pairs (debiasing + UltraFeedback) | ~26 h |
211
+ | ORPO-3 | LoRA r=8 | 2,104 preference pairs (Colombia identity focus) | ~54 h |
212
+
213
+ **Memory techniques that made 4 GB training possible:**
214
+ - Pre-tokenize dataset before loading model (prevents startup OOM)
215
+ - `device_map="auto"` β€” GPU + CPU split via Accelerate
216
+ - Gradient checkpointing + `bf16=True`
217
+ - ORPO with `ref_model=None` β€” saves ~1.2 GB vs DPO
218
+
219
+ Training scripts: [github.com/MichelangeloRomeroChisco/orchid](https://github.com/MichelangeloRomeroChisco/orchid)
220
+
221
+ ---
222
+
223
+ ## Hardware Requirements
224
+
225
+ | | Minimum | Recommended |
226
+ |-|---------|-------------|
227
+ | GPU VRAM | 0 (CPU-only works) | 4 GB (RTX 3050 class) |
228
+ | RAM | 8 GB | 16 GB |
229
+ | Storage | 1.3 GB | 2 GB |
230
+ | OS | Windows / Linux / macOS | β€” |
231
+
232
+ GPU mode: all 30 transformer layers offload to GPU using mixed F16 + INT8 quantization (~3.3 GB VRAM). CPU mode: ~6 tok/s with AVX2.
233
+
234
+ ---
235
+
236
+ ## Limitations
237
+
238
+ - **MMLU at 38.6%** β€” alignment tax from ORPO. Expected and documented in the technical paper.
239
+ - **Spanish coverage** β€” 80% on internal benchmark. Functional but not state-of-the-art.
240
+ - **Context window** β€” 4,096 tokens (inherited from BitNet base).
241
+ - **ternative.cpp required** β€” llama.cpp produces type-36 errors or silently wrong output.
242
+ - **Do not use BitsAndBytes** β€” stacking BNB quantization on top of BitNet's runtime ternary quantization is unsupported.
243
+ - **Identity requires system prompt** β€” without a system prompt Orchid may respond generically; ORPO baked the identity partially but not completely.
244
+
245
+ ---
246
+
247
+ ## Technical Paper
248
+
249
+ Full methodology, training details, failure modes, and architecture analysis:
250
+
251
+ **[Orchid 1.0: A Reproducible Recipe for Aligned Ternary-Weight Language Models on Consumer Hardware](https://huggingface.co/MicheRomChis/orchid-1.0/blob/main/orchid-1-0-technical-paper.pdf)**
252
+
253
+ ---
254
+
255
+ ## License
256
+
257
+ Apache 2.0 β€” free for research and commercial use.
258
+
259
+ This model is a fine-tuned derivative of **Microsoft BitNet b1.58-2B-4T** (MIT License).
260
+
261
+ ---
262
+
263
+ ## Citation
264
+
265
+ ```bibtex
266
+ @software{orchid_2026,
267
+ title = {Orchid 1.0: First Colombian LLM β€” Ternary-Weight Fine-Tuning on Consumer Hardware},
268
+ author = {Romero Chisco, Michelangelo},
269
+ year = {2026},
270
+ url = {https://huggingface.co/MicheRomChis/orchid-1.0},
271
+ license = {Apache-2.0},
272
+ note = {Fine-tuned from Microsoft BitNet b1.58-2B-4T}
273
+ }
274
+ ```
275
+
276
+ ---
277
+
278
+ ## Acknowledgments
279
+
280
+ - **Microsoft Research** β€” BitNet b1.58-2B-4T base model and architecture
281
+ - **The ggml / llama.cpp project** β€” GGUF format conventions
282
+ - **HuggingFace** β€” Training libraries (PEFT, TRL, Transformers, Accelerate)