Text Generation
Transformers
Safetensors
GGUF
lfm3
liquid
depth-loop
training-free
custom_code
conversational
Instructions to use vaultpls/LFM3-1.7B-Looped with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use vaultpls/LFM3-1.7B-Looped with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="vaultpls/LFM3-1.7B-Looped", 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("vaultpls/LFM3-1.7B-Looped", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("vaultpls/LFM3-1.7B-Looped", 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
- llama.cpp
How to use vaultpls/LFM3-1.7B-Looped 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 vaultpls/LFM3-1.7B-Looped:Q8_0 # Run inference directly in the terminal: llama cli -hf vaultpls/LFM3-1.7B-Looped:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf vaultpls/LFM3-1.7B-Looped:Q8_0 # Run inference directly in the terminal: llama cli -hf vaultpls/LFM3-1.7B-Looped:Q8_0
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf vaultpls/LFM3-1.7B-Looped:Q8_0 # Run inference directly in the terminal: ./build/bin/llama cli -hf vaultpls/LFM3-1.7B-Looped:Q8_0
Use Docker
docker model run hf.co/vaultpls/LFM3-1.7B-Looped:Q8_0
- Llama new
- LM Studio
- Jan
- vLLM
How to use vaultpls/LFM3-1.7B-Looped with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "vaultpls/LFM3-1.7B-Looped" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "vaultpls/LFM3-1.7B-Looped", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/vaultpls/LFM3-1.7B-Looped:Q8_0
- SGLang
How to use vaultpls/LFM3-1.7B-Looped 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 "vaultpls/LFM3-1.7B-Looped" \ --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": "vaultpls/LFM3-1.7B-Looped", "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 "vaultpls/LFM3-1.7B-Looped" \ --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": "vaultpls/LFM3-1.7B-Looped", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use vaultpls/LFM3-1.7B-Looped with Ollama:
ollama run hf.co/vaultpls/LFM3-1.7B-Looped:Q8_0
- Unsloth Desktop
- Pi
How to use vaultpls/LFM3-1.7B-Looped with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf vaultpls/LFM3-1.7B-Looped:Q8_0
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "vaultpls/LFM3-1.7B-Looped:Q8_0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use vaultpls/LFM3-1.7B-Looped with Docker Model Runner:
docker model run hf.co/vaultpls/LFM3-1.7B-Looped:Q8_0
- Lemonade
How to use vaultpls/LFM3-1.7B-Looped with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull vaultpls/LFM3-1.7B-Looped:Q8_0
Run and chat with the model
lemonade run user.LFM3-1.7B-Looped-Q8_0
List all available models
lemonade list
- Hermes Agent
How to use vaultpls/LFM3-1.7B-Looped with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf vaultpls/LFM3-1.7B-Looped:Q8_0
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:9931/v1 hermes config set model.default vaultpls/LFM3-1.7B-Looped:Q8_0
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use vaultpls/LFM3-1.7B-Looped with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf vaultpls/LFM3-1.7B-Looped:Q8_0
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:9931/v1 \ --custom-model-id "vaultpls/LFM3-1.7B-Looped:Q8_0" \ --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"
Card: add DSpark drafter section (restore frontmatter)
Browse files
README.md
CHANGED
|
@@ -1,155 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# LFM3-1.7B-Looped (layers 8-11, run twice)
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
residual branch of every pass is scaled by 0.5, which makes the result an ordinary 28-layer model
|
| 8 |
-
that runs on stock KV cache, bakes to GGUF, and serves in llama.cpp.
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
| WinoGrande, 0-shot, n=1267 | 54.7 | **57.4** | +2.7 pp (p=0.014) |
|
| 18 |
-
| ARC-Easy, 0-shot, n=2376 | 38.5 | **41.0** | +2.5 pp (p=0.0001) |
|
| 19 |
-
| ARC-Challenge, 0-shot, n=1172 | 26.1 | **27.7** | +1.6 pp (p=0.073) |
|
| 20 |
-
| PIQA, 0-shot, n=1838 | 60.3 | 60.6 | +0.3 pp (n.s.) |
|
| 21 |
-
| BoolQ, 0-shot, n=3270 | 75.4 | 74.8 | −0.6 pp (n.s.) |
|
| 22 |
-
| wikitext perplexity (HF, 1024-ctx windows) | 24.73 | **23.62** | −4.5% |
|
| 23 |
-
| wikitext perplexity (llama.cpp Q8) | 18.29 | **17.87** | −2.3% |
|
| 24 |
-
|
| 25 |
-
Cost: 1.73B → 1.97B parameters, 1.84 → 2.10 GB Q8 file, and about **11% slower decode**
|
| 26 |
-
(llama-bench, RTX 4070, Q8_0, `-ngl 99`: pp512 18184 → 16699 t/s, tg128 160.3 → 142.6 t/s).
|
| 27 |
|
| 28 |
-
##
|
| 29 |
|
| 30 |
-
|
| 31 |
-
**[vaultpls/LFM3-1.7B-DSpark-loop-taps](https://huggingface.co/vaultpls/LFM3-1.7B-DSpark-loop-taps)**
|
| 32 |
-
(344 MB GGUF, ~316M params, block size 8). It is the Apache-2.0 drafter trained against plain
|
| 33 |
-
LFM3-1.7B with the auxiliary hidden-state taps shifted to `[3, 11, 23, 27]` — the loop renumbers
|
| 34 |
-
every layer after the duplicated window, so the upstream taps `[3, 11, 19, 23]` would read the
|
| 35 |
-
wrong depths.
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
~34% on prose and ~66% on JSON. Two caveats: at `--parallel 8` with a unified KV cache the drafter
|
| 46 |
-
costs ~26% aggregate throughput, so it is single-stream only; and greedy text is not bit-identical
|
| 47 |
-
to the no-drafter run, so keep it off for reproducible benchmark runs.
|
| 48 |
|
| 49 |
-
##
|
| 50 |
|
| 51 |
-
|
| 52 |
-
The loop repeats the window as a damped fixed-point iteration with K=2:
|
| 53 |
|
|
|
|
|
|
|
| 54 |
```
|
| 55 |
-
h0 = x
|
| 56 |
-
h1 = h0 + 0.5 * (G(h0) - h0) # G = the four-layer block
|
| 57 |
-
h2 = h1 + 0.5 * (G(h1) - h1)
|
| 58 |
-
x' = h2
|
| 59 |
-
```
|
| 60 |
-
|
| 61 |
-
Because it is built as a *static* graph — the window is physically duplicated and both copies carry
|
| 62 |
-
`post_operator_norm.weight * 0.5` and `post_ffn_norm.weight * 0.5` — generation uses a normal KV cache
|
| 63 |
-
with no runtime wrapper, and the whole thing converts to GGUF.
|
| 64 |
-
|
| 65 |
-
The scaling must go in the **post-norms**, not in `o_proj`/`w2`: those feed an RMSNorm, which divides
|
| 66 |
-
the scale back out. Both the HF implementation and `llama.cpp`'s `lfm3.cpp` apply the post-norm to the
|
| 67 |
-
branch output *before* the residual add, so the edit is exact in both. Verified: hook-based reference
|
| 68 |
-
wrapper vs. static model max|Δlogit| = 0.0 at α ∈ {1.0, 0.5, 0.25}, and every scaled tensor in the
|
| 69 |
-
shipped GGUF is exactly 0.5× the base tensor (`scripts/check_loop_gguf.py`).
|
| 70 |
-
|
| 71 |
-
## What does not work (measured, same harness)
|
| 72 |
-
|
| 73 |
-
These were tried so you don't have to; numbers are ARC-Easy 5-shot / n=1000 unless noted.
|
| 74 |
-
|
| 75 |
-
* More passes: K=3 69.7, K=4 69.0 — flat inside noise.
|
| 76 |
-
* Different per-pass gains: RK2 midpoint (0.5 then 1.0) **63.6**, 0.7/0.3 66.5, 0.3/0.7 66.8.
|
| 77 |
-
The uniform half-step is a sharp optimum; the "better" integrator is the worst option.
|
| 78 |
-
* Multiple loop windows: adding [16-19] or [12-15] to [8-11]×2 changes nothing item-for-item
|
| 79 |
-
(0.0 pp, discordant 39/39); looping late layers [20-23] costs **−5.9 pp**.
|
| 80 |
-
* Logit ensemble with the unlooped base: monotonically worse (w=0.1 already −0.8 pp).
|
| 81 |
-
* Repeating only the shortconv sublayers (cheap depth): +0.3 pp, perplexity worse. The effect lives
|
| 82 |
-
in the attention sublayers.
|
| 83 |
-
* Attention temperature (q×0.9 / q×1.1): 69.2 / 69.0, dead flat.
|
| 84 |
-
* Global residual scaling ×0.8: **71.4 on ARC but wikitext PPL 23.6 → 44.5**. A multiple-choice gain
|
| 85 |
-
without a language-model gain, i.e. a scoring artifact. Rejected.
|
| 86 |
-
* GSM8K, n=80: 67.5 → 61.3, not significant — the one task where the loop is behind, on a small sample.
|
| 87 |
-
|
| 88 |
-
## Weights
|
| 89 |
-
|
| 90 |
-
Published at **https://huggingface.co/vaultpls/LFM3-1.7B-Looped** (`gguf/` + bf16).
|
| 91 |
|
| 92 |
-
|
| 93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
```
|
| 95 |
-
gguf/LFM3-1.7B-loop-8-11-Q8_0.gguf the artefact (Q8_0, 28 layers, 2.10 GB)
|
| 96 |
-
hf/ same weights in HF format (trust_remote_code)
|
| 97 |
-
scripts/tfl.py build/verify/eval the loop in HF
|
| 98 |
-
scripts/save_loop_hf.py write the looped model as an HF checkpoint
|
| 99 |
-
scripts/loop_gguf_k.py build the looped GGUF from a base GGUF
|
| 100 |
-
scripts/check_loop_gguf.py verify the GGUF surgery (exact 0.5× scaling)
|
| 101 |
-
scripts/lmstat.py, ens.py paired McNemar tables, logit-ensemble sweep
|
| 102 |
-
scripts/compose-loop.yaml llama.cpp container definition used for serving
|
| 103 |
-
results/ raw lm-eval results and sample-level JSON
|
| 104 |
-
```
|
| 105 |
-
|
| 106 |
-
## Quick start
|
| 107 |
|
| 108 |
-
|
|
|
|
| 109 |
|
| 110 |
-
|
| 111 |
-
llama-server -m LFM3-1.7B-loop-8-11-Q8_0.gguf --alias lfm3-loop \
|
| 112 |
-
-ngl 99 -fa on -c 131072 --jinja
|
| 113 |
-
```
|
| 114 |
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
-
```
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
```
|
| 122 |
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
## Limitations
|
| 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 |
-
Method inspired by *training-free depth looping* (arXiv 2605.23872), which explores running a
|
| 155 |
-
pretrained block more than once with damped sub-steps.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
license: other
|
| 4 |
+
license_name: lfm1.0
|
| 5 |
+
license_link: https://huggingface.co/LiquidAI/LFM3-1.7B-Base/blob/main/LICENSE
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
base_model: LiquidAI/LFM3-1.7B-Base
|
| 8 |
+
tags:
|
| 9 |
+
- liquid
|
| 10 |
+
- lfm3
|
| 11 |
+
- depth-loop
|
| 12 |
+
- training-free
|
| 13 |
+
- gguf
|
| 14 |
+
- custom_code
|
| 15 |
+
language:
|
| 16 |
+
- en
|
| 17 |
+
- ar
|
| 18 |
+
- zh
|
| 19 |
+
- fr
|
| 20 |
+
- de
|
| 21 |
+
- it
|
| 22 |
+
- ja
|
| 23 |
+
- ko
|
| 24 |
+
- pt
|
| 25 |
+
- es
|
| 26 |
+
- vi
|
| 27 |
+
- th
|
| 28 |
+
- id
|
| 29 |
+
- hi
|
| 30 |
+
- ru
|
| 31 |
+
- pl
|
| 32 |
+
---
|
| 33 |
+
|
| 34 |
# LFM3-1.7B-Looped (layers 8-11, run twice)
|
| 35 |
|
| 36 |
+
LFM3-1.7B-Base with **layers 8–11 executed twice**, each pass contributing **half a residual step**.
|
| 37 |
+
Training-free: no gradients, no new parameters, no data. The result is a plain 28-layer model, so it
|
| 38 |
+
generates with a stock KV cache and runs in llama.cpp.
|
| 39 |
|
| 40 |
+
## Model details
|
|
|
|
|
|
|
| 41 |
|
| 42 |
+
* Base: [LiquidAI/LFM3-1.7B-Base](https://huggingface.co/LiquidAI/LFM3-1.7B-Base) — 24 layers, hybrid
|
| 43 |
+
shortconv/attention, 2048 hidden, 7680 FFN, sliding-window attention every 4th layer.
|
| 44 |
+
* Modification: layers 8–11 duplicated once (new layers 12–15), and
|
| 45 |
+
`post_attention_norm.weight` / `post_ffw_norm.weight` multiplied by 0.5 on both the originals and
|
| 46 |
+
the copies. All later layers renumbered. `block_count` 24 → 28.
|
| 47 |
+
* Parameters: 1.73B → 1.97B. Q8_0 file 1.84 → 2.10 GB.
|
| 48 |
+
* Nothing else is changed: no fine-tuning, no merging, no calibration data.
|
| 49 |
|
| 50 |
+
The loop is the damped fixed point `h ← h + 0.5 · (G(h) − h)` applied twice, where `G` is the
|
| 51 |
+
four-layer block. Damping lives in the post-norms because those are applied to the branch output
|
| 52 |
+
before the residual add, in both the HF code and llama.cpp's `lfm3.cpp`; scaling `o_proj`/`w2`
|
| 53 |
+
instead would be divided out by the following RMSNorm. Verified exact: max|Δlogit| = 0.0 against a
|
| 54 |
+
runtime reference wrapper, 0.5× on every scaled tensor in the GGUF.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
+
## Evaluation
|
| 57 |
|
| 58 |
+
Same items, both models, paired. Full details and the negative results are in the repository README.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
+
| benchmark | base | this model | Δ |
|
| 61 |
+
|---|---|---|---|
|
| 62 |
+
| ARC-Easy 5-shot (n=1000) | 60.8 | 69.2 | +8.4 pp, p=2.4e-9 |
|
| 63 |
+
| ARC-Challenge 5-shot (n=1000) | 30.0 | 34.1 | +4.1 pp |
|
| 64 |
+
| HellaSwag 0-shot (n=10042) | 53.6 | 54.3 | +0.7 pp, p=0.006 |
|
| 65 |
+
| WinoGrande 0-shot (n=1267) | 54.7 | 57.4 | +2.7 pp, p=0.014 |
|
| 66 |
+
| ARC-Easy 0-shot (n=2376) | 38.5 | 41.0 | +2.5 pp, p=0.0001 |
|
| 67 |
+
| ARC-Challenge 0-shot (n=1172) | 26.1 | 27.7 | +1.6 pp, p=0.073 |
|
| 68 |
+
| PIQA 0-shot (n=1838) | 60.3 | 60.6 | +0.3 pp (n.s.) |
|
| 69 |
+
| BoolQ 0-shot (n=3270) | 75.4 | 74.8 | −0.6 pp (n.s.) |
|
| 70 |
+
| wikitext PPL (HF) | 24.73 | 23.62 | −4.5% |
|
| 71 |
+
| wikitext PPL (llama.cpp Q8) | 18.29 | 17.87 | −2.3% |
|
| 72 |
|
| 73 |
+
Throughput on an RTX 4070, Q8_0, `-ngl 99`, isolated llama-bench: pp512 18184 → 16699 t/s,
|
| 74 |
+
tg128 160.31 → 142.55 t/s.
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
+
## Use
|
| 77 |
|
| 78 |
+
llama.cpp (needs the LFM3 architecture, master ≥ `1014775c8`):
|
|
|
|
| 79 |
|
| 80 |
+
```bash
|
| 81 |
+
llama-server -m LFM3-1.7B-loop-8-11-Q8_0.gguf --alias lfm3-loop -ngl 99 -fa on -c 131072 --jinja
|
| 82 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
+
transformers:
|
| 85 |
|
| 86 |
+
```python
|
| 87 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 88 |
+
tok = AutoTokenizer.from_pretrained("vaultpls/LFM3-1.7B-Looped", trust_remote_code=True)
|
| 89 |
+
m = AutoModelForCausalLM.from_pretrained("vaultpls/LFM3-1.7B-Looped", trust_remote_code=True, dtype="bfloat16")
|
| 90 |
+
ids = tok("The capital of France is", return_tensors="pt").input_ids
|
| 91 |
+
print(tok.decode(m.generate(ids, max_new_tokens=32, do_sample=False)[0]))
|
| 92 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
+
The `hf/` folder carries the custom `modeling_lfm3.py`, `configuration_lfm3.py` and `lfm3_conv.py`
|
| 95 |
+
needed by `trust_remote_code`.
|
| 96 |
|
| 97 |
+
## Speculative decoding (DSpark)
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
+
A DSpark drafter for this model ships separately:
|
| 100 |
+
**[vaultpls/LFM3-1.7B-DSpark-loop-taps](https://huggingface.co/vaultpls/LFM3-1.7B-DSpark-loop-taps)**
|
| 101 |
+
(344 MB GGUF, ~316M params, block size 8). It is the Apache-2.0 drafter trained against plain
|
| 102 |
+
LFM3-1.7B with its auxiliary hidden-state taps moved to `[3, 11, 23, 27]`: the loop inserts four
|
| 103 |
+
layers after layer 11 and renumbers the rest, so the upstream taps `[3, 11, 19, 23]` would read the
|
| 104 |
+
wrong depths.
|
| 105 |
|
| 106 |
+
```bash
|
| 107 |
+
llama-server -m LFM3-1.7B-loop-8-11-Q8_0.gguf \
|
| 108 |
+
-md LFM3-1.7B-DSpark-loop-taps-Q8_0.gguf \
|
| 109 |
+
--spec-type draft-dspark --spec-draft-n-max 4 -c 131072 -ngl 99 -fa on -np 1
|
| 110 |
```
|
| 111 |
|
| 112 |
+
Measured on the RTX 4070, Q8_0, single stream, greedy, 16k ctx, 160-token generations (baseline
|
| 113 |
+
~183 t/s): prose **+45%**, structured JSON **+112%** (+172% at n-max 6), arithmetic **+95%**; draft
|
| 114 |
+
acceptance ~34% on prose and ~66% on JSON. Two caveats: at `--parallel 8` with a unified KV cache
|
| 115 |
+
the drafter costs ~26% aggregate throughput, so use it single-stream only; and greedy text is not
|
| 116 |
+
bit-identical to the no-drafter run, so keep it off for reproducible benchmarking.
|
| 117 |
|
| 118 |
## Limitations
|
| 119 |
|
| 120 |
+
* **Base checkpoint**, not instruction-tuned. With the chat template it emits a thinking trace
|
| 121 |
+
(`reasoning_content`) and returns empty `content` if `max_tokens` is too small. Use
|
| 122 |
+
`/v1/completions` for plain text, or set `chat_template_kwargs: {"enable_thinking": false}`.
|
| 123 |
+
* Gains are configuration-dependent: +8.4 pp on ARC-Easy at 5-shot vs +2.5 pp at 0-shot. The
|
| 124 |
+
canonical 25-shot ARC / 10-shot HellaSwag settings were not run.
|
| 125 |
+
* One model, one window, one architecture family. Late-layer loops degrade the model; don't move the
|
| 126 |
+
window into the last quarter without re-measuring.
|
| 127 |
+
* ~11% slower decode, ~14% larger file.
|
| 128 |
+
* No safety tuning was applied beyond whatever the base model carries.
|
| 129 |
+
|
| 130 |
+
## License
|
| 131 |
+
|
| 132 |
+
LFM Open License v1.0, inherited from the base model — commercial use limited by the revenue
|
| 133 |
+
threshold in Section 5. See `LICENSE`. Modified files are listed in `NOTICE`. Not affiliated with or
|
| 134 |
+
endorsed by Liquid AI; "LFM" is used only to describe the origin of the weights.
|
| 135 |
+
|
| 136 |
+
## Citation
|
| 137 |
+
|
| 138 |
+
```bibtex
|
| 139 |
+
@misc{lfm3_loop_8_11,
|
| 140 |
+
title = {LFM3-1.7B-loop-8-11: a training-free depth loop},
|
| 141 |
+
year = {2026},
|
| 142 |
+
note = {Derived from LiquidAI/LFM3-1.7B-Base by executing layers 8--11 twice at half step},
|
| 143 |
+
}
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
Method inspired by arXiv 2605.23872 (training-free looping / damped sub-steps).
|
|
|
|
|
|