Text Generation
Safetensors
GGUF
English
lfm2
heretic
uncensored
decensored
abliterated
coding-agent
tool-use
conversational
text-generation-inference
Instructions to use saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic:Q4_K_M # Run inference directly in the terminal: llama cli -hf saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic:Q4_K_M # Run inference directly in the terminal: llama cli -hf saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic:Q4_K_M
Use Docker
docker model run hf.co/saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic:Q4_K_M
- Ollama
How to use saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic with Ollama:
ollama run hf.co/saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic:Q4_K_M
- Unsloth Studio
How to use saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic to start chatting
- Pi
How to use saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic with Docker Model Runner:
docker model run hf.co/saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic:Q4_K_M
- Lemonade
How to use saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic:Q4_K_M
Run and chat with the model
lemonade run user.lfm2.5-2.6b-fable5-coding-agent-heretic-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "saidutta69/lfm2.5-2.6b-fable5-coding-agent-heretic:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,199 +1,277 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
| 2 |
library_name: transformers
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
|
|
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
|
|
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
|
| 14 |
-
### Model Description
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
-
- **
|
| 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 |
-
##
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
|
| 33 |
-
- **Paper [optional]:** [More Information Needed]
|
| 34 |
-
- **Demo [optional]:** [More Information Needed]
|
| 35 |
|
| 36 |
-
|
| 37 |
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
-
|
| 41 |
|
| 42 |
-
|
| 43 |
|
| 44 |
-
|
| 45 |
|
| 46 |
-
|
| 47 |
|
| 48 |
-
|
| 49 |
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
|
| 53 |
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
-
|
| 57 |
|
| 58 |
-
##
|
| 59 |
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
<
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
#
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
##
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 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)
|
|
|
|
|
|