Instructions to use FLs-AI/lfm2.5-350m-hssa with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FLs-AI/lfm2.5-350m-hssa with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="FLs-AI/lfm2.5-350m-hssa") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("FLs-AI/lfm2.5-350m-hssa") model = AutoModelForCausalLM.from_pretrained("FLs-AI/lfm2.5-350m-hssa", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use FLs-AI/lfm2.5-350m-hssa 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 FLs-AI/lfm2.5-350m-hssa:Q4_K_M # Run inference directly in the terminal: llama cli -hf FLs-AI/lfm2.5-350m-hssa:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf FLs-AI/lfm2.5-350m-hssa:Q4_K_M # Run inference directly in the terminal: llama cli -hf FLs-AI/lfm2.5-350m-hssa:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf FLs-AI/lfm2.5-350m-hssa:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf FLs-AI/lfm2.5-350m-hssa:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf FLs-AI/lfm2.5-350m-hssa:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf FLs-AI/lfm2.5-350m-hssa:Q4_K_M
Use Docker
docker model run hf.co/FLs-AI/lfm2.5-350m-hssa:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use FLs-AI/lfm2.5-350m-hssa with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "FLs-AI/lfm2.5-350m-hssa" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FLs-AI/lfm2.5-350m-hssa", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/FLs-AI/lfm2.5-350m-hssa:Q4_K_M
- SGLang
How to use FLs-AI/lfm2.5-350m-hssa 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 "FLs-AI/lfm2.5-350m-hssa" \ --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": "FLs-AI/lfm2.5-350m-hssa", "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 "FLs-AI/lfm2.5-350m-hssa" \ --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": "FLs-AI/lfm2.5-350m-hssa", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use FLs-AI/lfm2.5-350m-hssa with Ollama:
ollama run hf.co/FLs-AI/lfm2.5-350m-hssa:Q4_K_M
- Unsloth Studio
How to use FLs-AI/lfm2.5-350m-hssa with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for FLs-AI/lfm2.5-350m-hssa to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for FLs-AI/lfm2.5-350m-hssa to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for FLs-AI/lfm2.5-350m-hssa to start chatting
- Pi
How to use FLs-AI/lfm2.5-350m-hssa with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf FLs-AI/lfm2.5-350m-hssa:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "FLs-AI/lfm2.5-350m-hssa:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use FLs-AI/lfm2.5-350m-hssa with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf FLs-AI/lfm2.5-350m-hssa:Q4_K_M
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:8080/v1 hermes config set model.default FLs-AI/lfm2.5-350m-hssa:Q4_K_M
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use FLs-AI/lfm2.5-350m-hssa with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf FLs-AI/lfm2.5-350m-hssa:Q4_K_M
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:8080/v1 \ --custom-model-id "FLs-AI/lfm2.5-350m-hssa:Q4_K_M" \ --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"
- Docker Model Runner
How to use FLs-AI/lfm2.5-350m-hssa with Docker Model Runner:
docker model run hf.co/FLs-AI/lfm2.5-350m-hssa:Q4_K_M
- Lemonade
How to use FLs-AI/lfm2.5-350m-hssa with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull FLs-AI/lfm2.5-350m-hssa:Q4_K_M
Run and chat with the model
lemonade run user.lfm2.5-350m-hssa-Q4_K_M
List all available models
lemonade list
LFM2.5-350M-HSSA
An experimental variant of LiquidAI/LFM2.5-350M-Base in which the six full-attention (GQA) layers are replaced with Hierarchical Searchable Sparse Attention (HSSA), then continued-pretrained so the HSSA routers learn content-dependent block selection on real data.
The convolutional (LIV) blocks of LFM2 are left untouched. Only the attention
layers [2, 5, 8, 10, 12, 14] are converted. The donor Q/K/V/O projections and
per-head Q/K norms are preserved; HSSA adds two small router projections
(router_q_proj, router_k_proj, dim 128) per converted layer.
- Base model: LiquidAI/LFM2.5-350M-Base
- Parameters: ~356M (+ ~1.6M router parameters)
- Attention: HSSA on the 6 attention layers โ O(n log n) routed sparse attention: local window (256) + top-8 routed blocks of 64 tokens, selected by beam search over a balanced router tree
- Precision: bf16
- Continued pretraining: 2048-token windows, LR 2e-5, router supervision loss weight 0.1
- Intended use: research on sparse attention / edge text generation experiments
GGUF builds (llama.cpp / Ollama / LM Studio)
Quantized GGUF builds are provided. Important: GGUF builds run with dense attention โ the HSSA router tensors are stripped during conversion, because llama.cpp has no HSSA kernel. All fine-tuned backbone weights are identical to this checkpoint, so outputs are close to (but not exactly) the sparse-attention model.
| file | quant | size |
|---|---|---|
model-hssa-Q8_0.gguf |
Q8_0 | 379 MB |
model-hssa-Q6_K.gguf |
Q6_K | 293 MB |
model-hssa-Q4_K_M.gguf |
Q4_K_M | 229 MB |
llama-cli -m model-hssa-Q8_0.gguf -p "What is C. elegans?" -n 128
Q8_0 is recommended; at this model size Q4_K_M shows visible quality loss.
Using with transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "DarkKnighToS223/lfm2.5-350m-hssa"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, dtype="bfloat16")
Note: stock transformers loads the fine-tuned backbone with standard dense
attention; the HSSA router tensors in the checkpoint are ignored (same
behaviour as the GGUF builds).
The HSSA configuration is stored in hssa_conversion.json:
| knob | value |
|---|---|
| block_size | 64 |
| query_group_size | 16 |
| local_window | 256 |
| top_blocks | 8 |
| router_dim | 128 |
| router_beam_width | 16 |
Evaluation
Synthetic long-context retrieval suite (RULER-style; needle-in-a-haystack,
multi-needle, associative recall, copy, variable tracing), 75 fixed prompts,
answer_recall scoring. Contexts of 512/1024 tokens are within the CPT
training window; 2048-token prompts fall outside it.
Continued pretraining lifts overall recall from 0.03 (freshly converted, random routers) to 0.27.
| answer_recall | LFM2.5-350M-HSSA |
|---|---|
| overall (512+1024) | 0.27 |
| niah | 0.70 |
| multi_needle | 0.63 |
| associative_recall | 0.00 |
| copy | 0.00 |
| variable_trace | 0.00 |
Out-of-window contexts (2048-token targets, ~3.4k actual tokens): recall 0.08 โ degraded but non-zero, suggesting longer-window CPT would help. A dense baseline of the same family scores higher on this suite; that gap is the current cost of O(n log n) sparse attention after a short CPT run.
Training context
Continued pretraining was short (a few thousand steps on 2048-token windows) โ enough for the HSSA routers to learn sensible block selection after conversion. This is a research checkpoint, not a production-tuned model. Expect quality below the original LFM2.5-350M on knowledge-heavy tasks; this variant exists to study HSSA on a real, pretrained backbone.
Limitations
- GGUF builds and stock
transformersrun with dense attention; the HSSA routers are exercised only by the research training/eval framework. - Trained on 2048-token windows; retrieval degrades beyond that range.
- Base-model knowledge cutoff and biases are inherited; factual accuracy is limited at this scale.
Acknowledgements
Built on LiquidAI's LFM2.5-350M-Base. HSSA conversion, continued pretraining
- Downloads last month
- 543
4-bit
6-bit
8-bit
Model tree for FLs-AI/lfm2.5-350m-hssa
Base model
LiquidAI/LFM2.5-350M-Base