Instructions to use vaultpls/LFM3-1.7B-Looped-Distilled with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use vaultpls/LFM3-1.7B-Looped-Distilled with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="vaultpls/LFM3-1.7B-Looped-Distilled", 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-Distilled", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("vaultpls/LFM3-1.7B-Looped-Distilled", 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-Distilled 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-Distilled:Q8_0 # Run inference directly in the terminal: llama cli -hf vaultpls/LFM3-1.7B-Looped-Distilled: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-Distilled:Q8_0 # Run inference directly in the terminal: llama cli -hf vaultpls/LFM3-1.7B-Looped-Distilled: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-Distilled:Q8_0 # Run inference directly in the terminal: ./build/bin/llama cli -hf vaultpls/LFM3-1.7B-Looped-Distilled:Q8_0
Use Docker
docker model run hf.co/vaultpls/LFM3-1.7B-Looped-Distilled:Q8_0
- Llama new
- LM Studio
- Jan
- vLLM
How to use vaultpls/LFM3-1.7B-Looped-Distilled 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-Distilled" # 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-Distilled", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/vaultpls/LFM3-1.7B-Looped-Distilled:Q8_0
- SGLang
How to use vaultpls/LFM3-1.7B-Looped-Distilled 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-Distilled" \ --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-Distilled", "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-Distilled" \ --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-Distilled", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use vaultpls/LFM3-1.7B-Looped-Distilled with Ollama:
ollama run hf.co/vaultpls/LFM3-1.7B-Looped-Distilled:Q8_0
- Unsloth Desktop
- Pi
How to use vaultpls/LFM3-1.7B-Looped-Distilled 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-Distilled: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-Distilled:Q8_0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use vaultpls/LFM3-1.7B-Looped-Distilled with Docker Model Runner:
docker model run hf.co/vaultpls/LFM3-1.7B-Looped-Distilled:Q8_0
- Lemonade
How to use vaultpls/LFM3-1.7B-Looped-Distilled with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull vaultpls/LFM3-1.7B-Looped-Distilled:Q8_0
Run and chat with the model
lemonade run user.LFM3-1.7B-Looped-Distilled-Q8_0
List all available models
lemonade list
- Hermes Agent
How to use vaultpls/LFM3-1.7B-Looped-Distilled 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-Distilled: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-Distilled:Q8_0
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use vaultpls/LFM3-1.7B-Looped-Distilled 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-Distilled: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-Distilled: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"
LFM3-1.7B-Looped-Distilled
LFM3-1.7B-Base with the depth loop of LFM3-1.7B-Looped and a re-entry bridge distilled into the looped block. The result is a plain 28-layer model: no bridge module, no custom sampler, and a stock llama.cpp graph.
What was done
- Loop. The base has 24 layers. Layers 8-11 are executed twice: their copies become
layers 12-15, and the eight
post_attention_norm/post_ffw_normweights for layers 8-15 are multiplied by 0.5. This is the same damped depth loop as LFM3-1.7B-Looped:alpha=0.5, two passes, 28 layers total. - Teacher. A zero-initialised rank-64 re-entry bridge was trained on top of that loop: it reads the layer-7 output and writes into layer 12, with a tanh gate. The bridge has 0.26M parameters and was trained for 500 steps on the wikitext-train / GSM8K-chat mix. It is not shipped.
- Distillation. The bridge teacher was distilled into the looped block with rank-64 LoRA on layers 12-15 only. Loss was cross-entropy plus a normalised MSE to the teacher's final hidden states, computed on 250 x 1024-token wikitext-train windows; 500 steps, 10.7M trainable parameters (0.525% of the model). No GSM8K or instruction data was used for the student.
- Merge. The LoRA weights were merged into layers 12-15. The LoRA
Bmatrices for every other layer are exactly zero, so layers 0-11 and 16-27 carry no trained change. - Export. Standard HF checkpoint -> GGUF F16 -> Q8_0 with llama.cpp.
The loop is architectural: the GGUF has lfm3.block_count = 28, 335 tensors, and the
copied block repeated once. The bridge is not a runtime tensor; its effect lives in the
merged weights of the copied layers.
Evaluation
All numbers are 5-shot, greedy, on the same harness and tokenizer; paired per-item comparisons. ARC is n=1000; GSM8K is n=80.
| model | ARC-Easy | ARC-Challenge | GSM8K | wiki PPL (Q8_0) |
|---|---|---|---|---|
| LFM3-1.7B-Base | 60.8 | 30.0 | 67.5 | 18.42 |
| static loop [8-11]x2, alpha=0.5 | 69.2 | 34.1 | 61.3 | 17.92 |
| this model (wiki-only distill) | 69.8 | 40.5 | 67.5 | 13.72 |
Paired vs the static loop:
- ARC-Challenge: 136 wins / 72 losses, exact McNemar p = 1.0e-5.
- ARC-Easy: 93 / 87, p = 0.71 (tied).
- GSM8K: 9 / 4, p = 0.27 (n=80, not powered).
- PPL is
llama-perplexityonwikitext-test.txt, 1024-token chunks, Q8_0.
Reading the table honestly: the robust gain is ARC-Challenge (+6.4 pp, significant). ARC-Easy is flat versus the static loop. GSM8K returns to the base level rather than the static loop's drop, but the n=80 comparison is not significant. The PPL gain is partly in-domain because the distillation data is wikitext-train.
This is a base checkpoint, not an instruction-tuned model. The chat template works and
the model answers chat-style prompts, but it has no RLHF/DPO. Raw /v1/completions behaviour
is preserved; a 50/50 wikitext/GSM8K variant reached GSM8K 75.0 but degraded raw completions,
which is why it is not the released file.
Files
| file | notes |
|---|---|
model.safetensors |
bf16 HF checkpoint, 28 layers, 1.97B params |
gguf/LFM3-1.7B-Looped-Distilled-Q8_0.gguf |
2.0 GB, Q8_0, 28 blocks |
config.json, modeling_lfm3.py, ... |
standard LFM3 custom code |
LICENSE, NOTICE |
LFM Open License v1.0 and modification notice |
Usage
llama.cpp
llama-cli -m gguf/LFM3-1.7B-Looped-Distilled-Q8_0.gguf \
-p "The capital of France is" -n 64 -ngl 99
llama-server -m gguf/LFM3-1.7B-Looped-Distilled-Q8_0.gguf \
--alias lfm3-1.7b-looped-distilled -c 131072 -ngl 99 --jinja
The file is a normal 28-layer LFM3 graph; no patched llama.cpp is required. On an RTX 4070 it runs at about 180 tok/s decode and 17.5k tok/s prefill at Q8_0.
Transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("vaultpls/LFM3-1.7B-Looped-Distilled", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
"vaultpls/LFM3-1.7B-Looped-Distilled", trust_remote_code=True, torch_dtype="bfloat16"
).cuda()
ids = tok("The capital of France is", return_tensors="pt").input_ids.cuda()
print(tok.decode(model.generate(ids, max_new_tokens=32, do_sample=False)[0]))
Training details
- Teacher: static loop + zero-init rank-64 bridge (layer 7 -> layer 12), 500 steps on alternating wikitext-train / GSM8K-chat windows, AdamW, lr 1e-3 with warmup and cosine, batch 2 x 1024 tokens.
- Student: rank-64 LoRA (
alpha=128, dropout 0) onq_proj,k_proj,v_proj,o_proj,in_proj,out_proj,w1,w2,w3of layers 12-15; CE + normalised MSE (weight 1.0) to teacher final hidden states; 500 steps on 250 wikitext windows, lr 3e-4, cosine schedule, batch 2 x 1024 tokens, bf16. - Hardware: one RTX 4070 12 GB, gradient checkpointing.
- The scripts used are in
scripts/; paths in them are the local training paths and need adjusting for a fresh checkout.
Limitations
- Base model, not instruction-tuned; tool use and long multi-step agency are not trained.
- The loop is fixed at two passes and alpha=0.5; there is no adaptive loop count.
- ARC-Challenge is the only statistically solid gain. GSM8K n=80 is underpowered.
- Wiki PPL is in-domain relative to the distillation corpus.
- The model was distilled from a teacher trained on wikitext-train; it inherits the base model's language coverage and biases.
License and attribution
This is a derivative work of LiquidAI/LFM3-1.7B-Base,
distributed under the LFM Open License v1.0. A copy is in LICENSE; the required
modification notice is in NOTICE. No affiliation with or endorsement by Liquid AI is claimed.
The static-loop recipe follows arXiv:2605.23872; the re-entry-bridge teacher follows the idea in arXiv:2608.11233 (Retrofitting Recurrent Depth). The distillation and merge are this repository's work.
- Downloads last month
- 808
Model tree for vaultpls/LFM3-1.7B-Looped-Distilled
Base model
LiquidAI/LFM3-1.7B-Base