saidutta69 commited on
Commit
f4ebaee
·
verified ·
1 Parent(s): aaf66b2

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +248 -170
README.md CHANGED
@@ -1,199 +1,277 @@
1
  ---
 
 
 
2
  library_name: transformers
3
- tags: []
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  ---
 
5
 
6
- # Model Card for Model ID
 
 
 
7
 
8
- <!-- Provide a quick summary of what the model is/does. -->
 
 
 
 
 
 
 
 
 
 
 
 
9
 
 
10
 
 
 
 
 
11
 
12
- ## Model Details
13
 
14
- ### Model Description
15
 
16
- <!-- Provide a longer summary of what this model is. -->
17
 
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
 
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
 
28
- ### Model Sources [optional]
29
 
30
- <!-- Provide the basic links for the model. -->
 
 
 
 
 
 
 
 
 
 
 
31
 
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
 
36
- ## Uses
37
 
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
 
 
 
39
 
40
- ### Direct Use
41
 
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
 
44
- [More Information Needed]
45
 
46
- ### Downstream Use [optional]
47
 
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
 
50
- [More Information Needed]
 
 
 
 
51
 
52
- ### Out-of-Scope Use
53
 
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
 
 
 
 
 
 
55
 
56
- [More Information Needed]
57
 
58
- ## Bias, Risks, and Limitations
59
 
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
- [More Information Needed]
63
-
64
- ### Recommendations
65
-
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
-
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
-
70
- ## How to Get Started with the Model
71
-
72
- Use the code below to get started with the model.
73
-
74
- [More Information Needed]
75
-
76
- ## Training Details
77
-
78
- ### Training Data
79
-
80
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
-
82
- [More Information Needed]
83
-
84
- ### Training Procedure
85
-
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
-
88
- #### Preprocessing [optional]
89
-
90
- [More Information Needed]
91
-
92
-
93
- #### Training Hyperparameters
94
-
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
-
97
- #### Speeds, Sizes, Times [optional]
98
-
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
-
101
- [More Information Needed]
102
-
103
- ## Evaluation
104
-
105
- <!-- This section describes the evaluation protocols and provides the results. -->
106
-
107
- ### Testing Data, Factors & Metrics
108
-
109
- #### Testing Data
110
-
111
- <!-- This should link to a Dataset Card if possible. -->
112
-
113
- [More Information Needed]
114
-
115
- #### Factors
116
-
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
-
119
- [More Information Needed]
120
-
121
- #### Metrics
122
-
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
-
125
- [More Information Needed]
126
-
127
- ### Results
128
-
129
- [More Information Needed]
130
-
131
- #### Summary
132
-
133
-
134
-
135
- ## Model Examination [optional]
136
-
137
- <!-- Relevant interpretability work for the model goes here -->
138
-
139
- [More Information Needed]
140
-
141
- ## Environmental Impact
142
-
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
-
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
-
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
-
153
- ## Technical Specifications [optional]
154
-
155
- ### Model Architecture and Objective
156
-
157
- [More Information Needed]
158
-
159
- ### Compute Infrastructure
160
-
161
- [More Information Needed]
162
-
163
- #### Hardware
164
-
165
- [More Information Needed]
166
-
167
- #### Software
168
-
169
- [More Information Needed]
170
-
171
- ## Citation [optional]
172
-
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
-
175
- **BibTeX:**
176
-
177
- [More Information Needed]
178
-
179
- **APA:**
180
-
181
- [More Information Needed]
182
-
183
- ## Glossary [optional]
184
-
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
-
187
- [More Information Needed]
188
-
189
- ## More Information [optional]
190
-
191
- [More Information Needed]
192
-
193
- ## Model Card Authors [optional]
194
-
195
- [More Information Needed]
196
-
197
- ## Model Card Contact
198
-
199
- [More Information Needed]
 
1
  ---
2
+ base_model: LiquidAI/LFM2.5-2.6B
3
+ datasets:
4
+ - saidutta69/fable-5-premium
5
  library_name: transformers
6
+ pipeline_tag: text-generation
7
+ tags:
8
+ - lfm2
9
+ - full-parameter-fine-tuning
10
+ - supervised-fine-tuning
11
+ - assistant-only-loss
12
+ - tool-use
13
+ - coding-agent
14
+ - conversational
15
+ - heretic
16
+ - uncensored
17
+ - decensored
18
+ - abliterated
19
+ - reproducible
20
  ---
21
+ # This is a decensored version of [AyoubChLin/lfm2.5-2.6b-fable5-coding-agent](https://huggingface.co/AyoubChLin/lfm2.5-2.6b-fable5-coding-agent), made using [Heretic](https://heretic-project.org) v1.4.0
22
 
23
+ > [!TIP]
24
+ > **This model is reproducible!**
25
+ >
26
+ > See the [README](reproduce/README.md) in the `reproduce` directory for more information.
27
 
28
+ ## Abliteration parameters
29
+
30
+ | Parameter | Value |
31
+ | :-------- | :---: |
32
+ | **direction_index** | 17.56 |
33
+ | **attn.o_proj.max_weight** | 1.42 |
34
+ | **attn.o_proj.max_weight_position** | 21.61 |
35
+ | **attn.o_proj.min_weight** | 1.41 |
36
+ | **attn.o_proj.min_weight_distance** | 16.49 |
37
+ | **mlp.down_proj.max_weight** | 1.35 |
38
+ | **mlp.down_proj.max_weight_position** | 20.51 |
39
+ | **mlp.down_proj.min_weight** | 1.33 |
40
+ | **mlp.down_proj.min_weight_distance** | 14.17 |
41
 
42
+ ## Performance
43
 
44
+ | Metric | This model | Original model ([AyoubChLin/lfm2.5-2.6b-fable5-coding-agent](https://huggingface.co/AyoubChLin/lfm2.5-2.6b-fable5-coding-agent)) |
45
+ | :----- | :--------: | :---------------------------: |
46
+ | **KL divergence** | 0.0140 | 0 *(by definition)* |
47
+ | **Refusals** | 7/100 | 96/100 |
48
 
49
+ -----
50
 
 
51
 
52
+ # LFM2.5-2.6B Fable-5 Coding Agent
53
 
54
+ `AyoubChLin/lfm2.5-2.6b-fable5-coding-agent` is a **full-parameter supervised fine-tune** of [`LiquidAI/LFM2.5-2.6B`](https://huggingface.co/LiquidAI/LFM2.5-2.6B) on [`saidutta69/fable-5-premium`](https://huggingface.co/datasets/saidutta69/fable-5-premium).
55
 
56
+ The run optimized assistant responses in multi-turn conversations, including reasoning-style text and tool-call patterns. All **2,697,198,592 parameters** were trainable. This repository contains a complete BF16 model checkpoint—not a LoRA, QLoRA, PEFT adapter, or quantized-weight checkpoint. The 8-bit optimizer affected optimizer-state storage only.
 
 
 
 
 
 
57
 
58
+ ## Model details
59
 
60
+ | Field | Value |
61
+ |---|---|
62
+ | Base model | `LiquidAI/LFM2.5-2.6B` |
63
+ | Architecture | Causal language model |
64
+ | Fine-tuning method | Full-parameter supervised fine-tuning |
65
+ | Parameters | 2,697,198,592 total; 100% trainable |
66
+ | Training precision | BF16, with TF32 enabled |
67
+ | Maximum sequence length used for SFT | 32,000 tokens |
68
+ | Training objective | Assistant-only next-token loss |
69
+ | Chat formatting | Base model's native chat template |
70
+ | Tool-call preprocessing | JSON argument strings converted to mappings for the native LFM2.5 tool-call format |
71
+ | Reasoning data | Preserved during training (`PRESERVE_THINKING=True`) |
72
 
73
+ ## Intended use
 
 
74
 
75
+ This checkpoint is intended for research and evaluation involving:
76
 
77
+ - multi-turn assistant behavior;
78
+ - code generation and explanation;
79
+ - structured tool-call generation in a controlled agent harness; and
80
+ - further evaluation or domain adaptation.
81
 
82
+ It should not be treated as production-ready based on the evidence currently available. The recorded run did not measure code correctness, tool-call validity, factuality, security, safety, bias, multilingual performance, instruction following, or agent-task completion.
83
 
84
+ ## Training data
85
 
86
+ The run loaded the `openai_chat` Parquet files explicitly so each published split was included once. It used the **first 5,000 rows** of the training split and the complete validation and test splits.
87
 
88
+ Only assistant tokens contributed to the loss. System, user, tool-result, and padding tokens were masked with label `-100`; assistant tool calls remained supervised. No row was removed by the post-tokenization assistant-label check.
89
 
90
+ ### Tokenized split statistics
91
 
92
+ | Split | Rows | Mean tokens | P95 tokens | Rows truncated at 32,000 | Mean supervised assistant tokens |
93
+ |---|---:|---:|---:|---:|---:|
94
+ | Train | 5,000 | 23,167.7 | 32,000 | 2,609 (52.18%) | 6,335.1 |
95
+ | Validation | 318 | 23,010.3 | 32,000 | 165 (51.89%) | 6,331.9 |
96
+ | Test | 319 | 22,812.0 | 32,000 | 154 (48.28%) | 6,370.4 |
97
 
98
+ Before truncation, the 5,000 selected training rows had the following length distribution:
99
 
100
+ | Statistic | Tokens |
101
+ |---|---:|
102
+ | P50 | 33,351 |
103
+ | P90 | 65,820 |
104
+ | P95 | 76,467 |
105
+ | P99 | 92,063 |
106
+ | Maximum | 104,776 |
107
 
108
+ Because more than half of the selected training rows exceeded the 32,000-token training cap, long conversations were frequently truncated.
109
 
110
+ ## Training procedure
111
 
112
+ | Hyperparameter | Recorded value |
113
+ |---|---|
114
+ | Epochs | 1 |
115
+ | Micro-batch size | 2 |
116
+ | Gradient accumulation | 4 |
117
+ | Effective batch size | 8 sequences per optimizer step |
118
+ | Evaluation batch size | 1 |
119
+ | Learning rate | `2e-5` |
120
+ | Weight decay | `0.1` |
121
+ | Scheduler | Cosine |
122
+ | Warm-up argument | `0.03` supplied to `warmup_steps` |
123
+ | Optimizer | 8-bit AdamW (`adamw_bnb_8bit`) |
124
+ | Gradient clipping | `1.0` |
125
+ | Gradient checkpointing | Enabled, non-reentrant |
126
+ | Seed / data seed | 42 / 42 |
127
+ | Evaluation cadence | Every 100 optimizer steps |
128
+ | Checkpoint strategy | Once per epoch, model weights only |
129
+ | Hardware | 1× NVIDIA B200, 178.4 GiB VRAM |
130
+ | Software observed | PyTorch 2.8.0+cu129; CUDA 12.9; Transformers 5.15.0 |
131
+
132
+ Checkpoints were saved with `save_only_model=True`. They are suitable for evaluation or deployment, but they do not contain optimizer and scheduler states for an exact training resume.
133
+
134
+ ## Results
135
+
136
+ | Split / metric | Value | Derived perplexity |
137
+ |---|---:|---:|
138
+ | Training loss | 0.1316 | 1.1406 |
139
+ | Validation loss | 0.3445 | 1.4113 |
140
+ | Held-out test loss | 0.3458 | 1.4131 |
141
 
142
+ Training completed in **15,553.2 seconds** (approximately **4 h 19 min 13 s**) at 0.321 samples/second and 0.040 optimizer steps/second. The run reported approximately `2.134e18` floating-point operations.
143
+
144
+ Perplexity is calculated as `exp(loss)`. All losses cover only the assistant tokens selected by the masking procedure, so they are not directly comparable with full-sequence language-model losses. Training loss is averaged over the optimization trajectory, whereas validation and test losses were measured after training.
145
+
146
+ The held-out test split was not used for optimization or periodic validation. No pre-fine-tuning baseline, external benchmark, confidence interval, or repeated-seed result was recorded. These results establish held-out assistant-token loss for this run; they do not by themselves demonstrate improvement over the base model or general coding-agent quality.
147
+
148
+ ## Qualitative observation
149
+
150
+ For one interval-merging prompt, the checkpoint produced a structured plan and emitted a native `write(...)` tool call without an explicit tool schema in the prompt. The generation reached the configured `max_new_tokens=768` limit before completing the program, and the resulting code was not executed or scored.
151
+
152
+ This is an illustration, not an evaluation. In deployment:
153
+
154
+ 1. Provide explicit tool definitions through the serving or agent layer.
155
+ 2. Parse, authorize, and validate every generated tool call before execution.
156
+ 3. Run generated code in a sandbox and verify it with independent tests.
157
+ 4. Do not expose preserved reasoning traces when the product requires private internal reasoning.
158
+
159
+ ## Inference with Transformers
160
+
161
+ Install a recent Transformers release:
162
+
163
+ ```bash
164
+ %pip install -q --upgrade \
165
+ "transformers==5.15.0" \
166
+ "accelerate>=1.10,<2" \
167
+ "safetensors>=0.6" \
168
+ "huggingface_hub>=0.34"
169
+ ```
170
+
171
+ Then apply the checkpoint's native chat template:
172
+
173
+ ```python
174
+ import torch
175
+ from transformers import AutoModelForCausalLM, AutoTokenizer
176
+
177
+ MODEL_ID = "AyoubChLin/lfm2.5-2.6b-fable5-coding-agent"
178
+
179
+ tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
180
+
181
+ model = AutoModelForCausalLM.from_pretrained(
182
+ MODEL_ID,
183
+ dtype=torch.float16, # Important: T4 uses FP16, not BF16
184
+ device_map={"": 0}, # Keep the complete model on GPU 0
185
+ low_cpu_mem_usage=True,
186
+ attn_implementation="sdpa", # No external flash-attn installation
187
+ )
188
+
189
+ model.eval()
190
+
191
+ parameter = next(model.parameters())
192
+ print("Model device:", parameter.device)
193
+ print("Model dtype:", parameter.dtype)
194
+
195
+ assert parameter.device.type == "cuda"
196
+ assert parameter.dtype == torch.float16
197
+
198
+ messages = [
199
+ {
200
+ "role": "system",
201
+ "content": (
202
+ "You are a careful coding assistant. Return complete, executable "
203
+ "code and briefly explain how it was verified."
204
+ ),
205
+ },
206
+ {
207
+ "role": "user",
208
+ "content": (
209
+ "Write a Python function that merges overlapping integer intervals. "
210
+ "Include pytest tests."
211
+ ),
212
+ },
213
+ ]
214
+
215
+ inputs = tokenizer.apply_chat_template(
216
+ messages,
217
+ tokenize=True,
218
+ add_generation_prompt=True,
219
+ return_tensors="pt",
220
+ return_dict=True,
221
+ truncation=True,
222
+ max_length=8192, # Safe starting point for a T4
223
+ ).to("cuda:0")
224
+
225
+ prompt_length = inputs["input_ids"].shape[1]
226
+
227
+ with torch.inference_mode():
228
+ output = model.generate(
229
+ **inputs,
230
+ max_new_tokens=768,
231
+ do_sample=True,
232
+ temperature=0.1,
233
+ top_k=50,
234
+ repetition_penalty=1.1,
235
+ use_cache=True,
236
+ pad_token_id=tokenizer.pad_token_id,
237
+ eos_token_id=tokenizer.eos_token_id,
238
+ )
239
+
240
+ generated_tokens = output[0, prompt_length:]
241
+
242
+ print(
243
+ tokenizer.decode(
244
+ generated_tokens,
245
+ skip_special_tokens=False,
246
+ )
247
+ )
248
+
249
+ ```
250
+
251
+ `skip_special_tokens=False` preserves native reasoning and tool-call delimiters for inspection by a compatible parser. Do not send raw reasoning or unvalidated tool syntax directly to end users or executors.
252
+
253
+ ## Reproducibility notes
254
+
255
+ - The source run used a single NVIDIA B200 with native BF16 support.
256
+ - The model remained in BF16 and all parameters were updated; `adamw_bnb_8bit` reduced optimizer-state memory only.
257
+ - OpenAI-style tool-call argument strings were normalized into mappings before the native chat template was applied.
258
+ - `PRESERVE_THINKING=True` retained supplied thinking content.
259
+ - The variable named `WARMUP_RATIO` was passed to `warmup_steps`, not `warmup_ratio`; this card reports the executed configuration rather than reinterpreting it.
260
+ - The bitsandbytes runtime reported that no CUDA 12.9 binary was available and loaded its CUDA 12.8 build instead.
261
+ - The environment reported Linux kernel 4.19.0, below the Trainer warning's recommended minimum of 5.5.0.
262
+
263
+ ## Limitations and responsible use
264
+
265
+ - Generated code and tool calls may be incomplete, incorrect, unsafe, or incompatible with the target environment.
266
+ - Reasoning-style text may be exposed because the training data preserved it.
267
+ - The training set was a deterministic 5,000-row prefix rather than the complete published training split.
268
+ - Heavy 32K truncation may weaken behavior that depends on information appearing late in long conversations.
269
+ - Tool-call patterns were learned without complete tool schemas; applications must supply schemas and enforce permissions externally.
270
+ - The checkpoint inherits limitations from the base model and the fine-tuning dataset.
271
+
272
+ Review and comply with the licenses and terms of both the [base model](https://huggingface.co/LiquidAI/LFM2.5-2.6B) and the [training dataset](https://huggingface.co/datasets/saidutta69/fable-5-premium) before use or redistribution. This model card does not grant additional rights.
273
+
274
+ ## Acknowledgements
275
+
276
+ - Base model: [LiquidAI/LFM2.5-2.6B](https://huggingface.co/LiquidAI/LFM2.5-2.6B)
277
+ - Training dataset: [saidutta69/fable-5-premium](https://huggingface.co/datasets/saidutta69/fable-5-premium)