--- library_name: transformers license: other license_name: lfm1.0 license_link: https://huggingface.co/LiquidAI/LFM3-1.7B-Base/blob/main/LICENSE pipeline_tag: text-generation base_model: LiquidAI/LFM3-1.7B-Base tags: - liquid - lfm3 - depth-loop - training-free - gguf - custom_code language: - en - ar - zh - fr - de - it - ja - ko - pt - es - vi - th - id - hi - ru - pl --- # LFM3-1.7B-Looped (layers 8-11, run twice) LFM3-1.7B-Base with **layers 8–11 executed twice**, each pass contributing **half a residual step**. Training-free: no gradients, no new parameters, no data. The result is a plain 28-layer model, so it generates with a stock KV cache and runs in llama.cpp. ## Model details * Base: [LiquidAI/LFM3-1.7B-Base](https://huggingface.co/LiquidAI/LFM3-1.7B-Base) — 24 layers, hybrid shortconv/attention, 2048 hidden, 7680 FFN, sliding-window attention every 4th layer. * Modification: layers 8–11 duplicated once (new layers 12–15), and `post_attention_norm.weight` / `post_ffw_norm.weight` multiplied by 0.5 on both the originals and the copies. All later layers renumbered. `block_count` 24 → 28. * Parameters: 1.73B → 1.97B. Q8_0 file 1.84 → 2.10 GB. * Nothing else is changed: no fine-tuning, no merging, no calibration data. The loop is the damped fixed point `h ← h + 0.5 · (G(h) − h)` applied twice, where `G` is the four-layer block. Damping lives in the post-norms because those are applied to the branch output before the residual add, in both the HF code and llama.cpp's `lfm3.cpp`; scaling `o_proj`/`w2` instead would be divided out by the following RMSNorm. Verified exact: max|Δlogit| = 0.0 against a runtime reference wrapper, 0.5× on every scaled tensor in the GGUF. ## Evaluation Same items, both models, paired. Full details and the negative results are in the repository README. | benchmark | base | this model | Δ | |---|---|---|---| | ARC-Easy 5-shot (n=1000) | 60.8 | 69.2 | +8.4 pp, p=2.4e-9 | | ARC-Challenge 5-shot (n=1000) | 30.0 | 34.1 | +4.1 pp | | HellaSwag 0-shot (n=10042) | 53.6 | 54.3 | +0.7 pp, p=0.006 | | WinoGrande 0-shot (n=1267) | 54.7 | 57.4 | +2.7 pp, p=0.014 | | ARC-Easy 0-shot (n=2376) | 38.5 | 41.0 | +2.5 pp, p=0.0001 | | ARC-Challenge 0-shot (n=1172) | 26.1 | 27.7 | +1.6 pp, p=0.073 | | PIQA 0-shot (n=1838) | 60.3 | 60.6 | +0.3 pp (n.s.) | | BoolQ 0-shot (n=3270) | 75.4 | 74.8 | −0.6 pp (n.s.) | | wikitext PPL (HF) | 24.73 | 23.62 | −4.5% | | wikitext PPL (llama.cpp Q8) | 18.29 | 17.87 | −2.3% | Throughput on an RTX 4070, Q8_0, `-ngl 99`, isolated llama-bench: pp512 18184 → 16699 t/s, tg128 160.31 → 142.55 t/s. ## Use llama.cpp (needs the LFM3 architecture, master ≥ `1014775c8`): ```bash llama-server -m LFM3-1.7B-loop-8-11-Q8_0.gguf --alias lfm3-loop -ngl 99 -fa on -c 131072 --jinja ``` transformers: ```python from transformers import AutoModelForCausalLM, AutoTokenizer tok = AutoTokenizer.from_pretrained("vaultpls/LFM3-1.7B-Looped", trust_remote_code=True) m = AutoModelForCausalLM.from_pretrained("vaultpls/LFM3-1.7B-Looped", trust_remote_code=True, dtype="bfloat16") ids = tok("The capital of France is", return_tensors="pt").input_ids print(tok.decode(m.generate(ids, max_new_tokens=32, do_sample=False)[0])) ``` The `hf/` folder carries the custom `modeling_lfm3.py`, `configuration_lfm3.py` and `lfm3_conv.py` needed by `trust_remote_code`. ## Limitations * **Base checkpoint**, not instruction-tuned. With the chat template it emits a thinking trace (`reasoning_content`) and returns empty `content` if `max_tokens` is too small. Use `/v1/completions` for plain text, or set `chat_template_kwargs: {"enable_thinking": false}`. * Gains are configuration-dependent: +8.4 pp on ARC-Easy at 5-shot vs +2.5 pp at 0-shot. The canonical 25-shot ARC / 10-shot HellaSwag settings were not run. * One model, one window, one architecture family. Late-layer loops degrade the model; don't move the window into the last quarter without re-measuring. * ~11% slower decode, ~14% larger file. * No safety tuning was applied beyond whatever the base model carries. ## License LFM Open License v1.0, inherited from the base model — commercial use limited by the revenue threshold in Section 5. See `LICENSE`. Modified files are listed in `NOTICE`. Not affiliated with or endorsed by Liquid AI; "LFM" is used only to describe the origin of the weights. ## Citation ```bibtex @misc{lfm3_loop_8_11, title = {LFM3-1.7B-loop-8-11: a training-free depth loop}, year = {2026}, note = {Derived from LiquidAI/LFM3-1.7B-Base by executing layers 8--11 twice at half step}, } ``` Method inspired by arXiv 2605.23872 (training-free looping / damped sub-steps).