File size: 3,067 Bytes
1a2bb00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
license: other
license_name: lfm1.0
license_link: LICENSE
base_model: LiquidAI/LFM2.5-1.2B-Instruct
library_name: transformers
pipeline_tag: text-generation
language: [en, ar, zh, fr, de, ja, ko, es]
tags: [liquid, lfm2.5, weight-editing, model-editing, json, training-free]
---

# LFM2.5-1.2B-Instruct-WSP-JSONFix

`LiquidAI/LFM2.5-1.2B-Instruct` (revision `b9d816ab510f9a28dca37cb182e9da8b0226e13c`) with a **training-free, sparse, reversible weight edit** that stops the model from wrapping strict-JSON answers in markdown code fences. No gradient descent, fine-tuning, LoRA or dataset updates were used: 16 columns of the FFN down-projection (`w2`) in layers 12 to 15 were scaled by exactly 0.5, changing 32,768 stored BF16 values (0.0028% of the model).

This is a behavior repair, not a new capability.

## Held-out test results (evaluated once, after selection)
| | Base | This model |
|---|---|---|
| Strict-JSON exact match (greedy + 3 sampled seeds, 256 units) | 167/256 | 196/256 (29 fixed, 0 broken) |
| Strict-JSON exact match, greedy (64 prompts) | 42/64 | 49/64 |
| Replies wrapped in code fences | 41/256 | 0/256 |
| Top-level JSON arrays exact | 76/128 | 97/128 (0 broken) |
| JSON objects exact | 91/128 | 99/128 |
| Prompts that request a code block (fence kept) | 48/48 | 48/48 |
| Short exact answers / general sanity | 57/64, 64/64 | 57/64, 64/64 |
| Termination tasks | 36/64 | 35/64 |
| WikiText-2 perplexity | 130.547 | -0.073% relative |

Matched controls (same size, random columns or random directions) stayed at base level (166 to 167/256). Benchmark: regenerated, template-based, 64 strict-JSON test prompts (32 objects, 32 arrays), small sample; see `wsp/WSP_1_2B_Experiment_Report.md` for methods, all 12 candidates, gates and limitations. Most fences in the base model came from weakly worded instructions such as "Answer in JSON."

## Edit
| tensor | columns (scaled x0.5) |
|---|---|
| model.layers.12.feed_forward.w2.weight | 4731, 7264, 7919 |
| model.layers.13.feed_forward.w2.weight | 488, 5186, 6715 |
| model.layers.14.feed_forward.w2.weight | 3659 |
| model.layers.15.feed_forward.w2.weight | 99, 532, 660, 926, 2017, 2439, 3263, 3682, 5191 |

`wsp/` contains the sparse patch (`chosen_patch.safetensors`, coordinates plus original and edited values), its manifest, and `apply_patch.py` / `rebuild_patch.py` to apply, revert or regenerate it bitwise from the base model.

## Usage
Same as the base model (chat template, tokenizer and generation settings unchanged):
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix")
model = AutoModelForCausalLM.from_pretrained("yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix", dtype="bfloat16")
```

## License and modification notice
Derivative of LiquidAI/LFM2.5-1.2B-Instruct by Liquid AI, distributed under the LFM Open License v1.0 (`LICENSE`, unchanged). Modified files: `model.safetensors` (the 32,768 values listed above). All other model files are copied from the base revision.