Instructions to use yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix") model = AutoModelForCausalLM.from_pretrained("yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix
- SGLang
How to use yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix with Docker Model Runner:
docker model run hf.co/yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix
Download README.md from yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix: direct link, hf CLI and curl.
- Browser
- Download file 3.07 kB
-
https://huggingface.co/yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix/resolve/main/README.md
- Command line
-
hf download hf://yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix/README.md
-
curl -L -o README.md https://huggingface.co/yasserrmd/LFM2.5-1.2B-Instruct-WSP-JSONFix/resolve/main/README.md
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):
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.