Text Generation
Transformers
Safetensors
lfm3
liquid
edge
conversational
custom-code
weight-edited
custom_code
Instructions to use cbert33/LFM3-1.7B-UtilityModel-edited-weights with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cbert33/LFM3-1.7B-UtilityModel-edited-weights with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cbert33/LFM3-1.7B-UtilityModel-edited-weights", trust_remote_code=True) 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("cbert33/LFM3-1.7B-UtilityModel-edited-weights", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("cbert33/LFM3-1.7B-UtilityModel-edited-weights", trust_remote_code=True, 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 cbert33/LFM3-1.7B-UtilityModel-edited-weights with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cbert33/LFM3-1.7B-UtilityModel-edited-weights" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cbert33/LFM3-1.7B-UtilityModel-edited-weights", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/cbert33/LFM3-1.7B-UtilityModel-edited-weights
- SGLang
How to use cbert33/LFM3-1.7B-UtilityModel-edited-weights 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 "cbert33/LFM3-1.7B-UtilityModel-edited-weights" \ --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": "cbert33/LFM3-1.7B-UtilityModel-edited-weights", "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 "cbert33/LFM3-1.7B-UtilityModel-edited-weights" \ --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": "cbert33/LFM3-1.7B-UtilityModel-edited-weights", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use cbert33/LFM3-1.7B-UtilityModel-edited-weights with Docker Model Runner:
docker model run hf.co/cbert33/LFM3-1.7B-UtilityModel-edited-weights
Add baselines, final numbers, deltas, and slice explanations to JSON and looping sections
Browse files
README.md
CHANGED
|
@@ -47,12 +47,18 @@ This is a weight-edited version of [LiquidAI/LFM3-1.7B](https://huggingface.co/L
|
|
| 47 |
- All other tensors byte-identical; the readout is linear, so each push is exact.
|
| 48 |
- Mechanism: at antml decision states the newline token (row 207) wins by ~29 logits over both `{` and `<`. Suppressing the newline family along the antml-state direction releases the brace gate.
|
| 49 |
|
| 50 |
-
**
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
## Looping behavior
|
| 58 |
|
|
@@ -65,13 +71,19 @@ This is a weight-edited version of [LiquidAI/LFM3-1.7B](https://huggingface.co/L
|
|
| 65 |
- Embedding edit: rows 22 (`.`) and 39 (`?`) shifted by +0.10 times the boundary brace-logit direction, where the direction is the boundary state minus the prose and post-brace states.
|
| 66 |
- All other tensors byte-identical.
|
| 67 |
|
| 68 |
-
**
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
| Slice | ramble rate | median narration words | mean gen tokens |
|
| 71 |
|---|---:|---:|---:|
|
| 72 |
| seed-14, 50 prompts | 64.0% | 508 | 1951 |
|
| 73 |
| held-out seed-15, 20 prompts | 75.0% | 524 | 1848 |
|
| 74 |
|
|
|
|
|
|
|
| 75 |
## Files and reproducibility
|
| 76 |
|
| 77 |
- `model.safetensors` - the edited weights (bf16, 3.98 GB).
|
|
|
|
| 47 |
- All other tensors byte-identical; the readout is linear, so each push is exact.
|
| 48 |
- Mechanism: at antml decision states the newline token (row 207) wins by ~29 logits over both `{` and `<`. Suppressing the newline family along the antml-state direction releases the brace gate.
|
| 49 |
|
| 50 |
+
**Slices:** seed 11 is the original held-out slice used to measure the JSON-format edit (50 prompts x 3 samples = 150 per arm). Seed 14 is the development slice used to fit and screen the later edits (50 prompts x 1 sample). Held-out seed 15 is a disjoint slice (20 prompts) the edits never saw, used as a generalization check.
|
| 51 |
|
| 52 |
+
**Original baseline (LiquidAI/LFM3-1.7B, seed-11 slice):** pure JSON 42.0%, parseable 68.7%, mean gen tokens 2008.
|
| 53 |
+
|
| 54 |
+
**Final numbers:**
|
| 55 |
+
|
| 56 |
+
| Slice | pure JSON | parseable | malformed | mean gen tokens |
|
| 57 |
+
|---|---:|---:|---:|---:|
|
| 58 |
+
| seed-14, 50 prompts | 88.0% | 88.0% | 12.0% | 1951 |
|
| 59 |
+
| held-out seed-15, 20 prompts | 100.0% | 100.0% | 0.0% | 1848 |
|
| 60 |
+
|
| 61 |
+
**Deltas vs original baseline:** seed-14: +46.0 pts pure JSON, +19.3 pts parseable, -2.8% tokens. Held-out seed-15: +58.0 pts pure JSON, +31.3 pts parseable, -8.0% tokens.
|
| 62 |
|
| 63 |
## Looping behavior
|
| 64 |
|
|
|
|
| 71 |
- Embedding edit: rows 22 (`.`) and 39 (`?`) shifted by +0.10 times the boundary brace-logit direction, where the direction is the boundary state minus the prose and post-brace states.
|
| 72 |
- All other tensors byte-identical.
|
| 73 |
|
| 74 |
+
**Slices:** seed 14 is the development slice used to fit and screen the looping and embedding edits (50 prompts x 1 sample). Held-out seed 15 is a disjoint slice (20 prompts) the edits never saw.
|
| 75 |
+
|
| 76 |
+
**Original baseline (the JSON-format edit, seed-14 slice):** ramble rate 72.0%, mean gen tokens 2238.
|
| 77 |
+
|
| 78 |
+
**Final numbers:**
|
| 79 |
|
| 80 |
| Slice | ramble rate | median narration words | mean gen tokens |
|
| 81 |
|---|---:|---:|---:|
|
| 82 |
| seed-14, 50 prompts | 64.0% | 508 | 1951 |
|
| 83 |
| held-out seed-15, 20 prompts | 75.0% | 524 | 1848 |
|
| 84 |
|
| 85 |
+
**Deltas:** seed-14 vs baseline: -8.0 pts ramble, -12.8% tokens. Held-out seed-15 vs the prior version (70.0% ramble, 1514 tokens): +5.0 pts ramble, +22.1% tokens.
|
| 86 |
+
|
| 87 |
## Files and reproducibility
|
| 88 |
|
| 89 |
- `model.safetensors` - the edited weights (bf16, 3.98 GB).
|