Instructions to use mohommed/LFM3-1.7B-Frontier-SmartAgent with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mohommed/LFM3-1.7B-Frontier-SmartAgent with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mohommed/LFM3-1.7B-Frontier-SmartAgent", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("mohommed/LFM3-1.7B-Frontier-SmartAgent", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use mohommed/LFM3-1.7B-Frontier-SmartAgent 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 mohommed/LFM3-1.7B-Frontier-SmartAgent:Q4_K_M # Run inference directly in the terminal: llama cli -hf mohommed/LFM3-1.7B-Frontier-SmartAgent:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf mohommed/LFM3-1.7B-Frontier-SmartAgent:Q4_K_M # Run inference directly in the terminal: llama cli -hf mohommed/LFM3-1.7B-Frontier-SmartAgent:Q4_K_M
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 mohommed/LFM3-1.7B-Frontier-SmartAgent:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf mohommed/LFM3-1.7B-Frontier-SmartAgent:Q4_K_M
Use Docker
docker model run hf.co/mohommed/LFM3-1.7B-Frontier-SmartAgent:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use mohommed/LFM3-1.7B-Frontier-SmartAgent with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mohommed/LFM3-1.7B-Frontier-SmartAgent" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mohommed/LFM3-1.7B-Frontier-SmartAgent", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mohommed/LFM3-1.7B-Frontier-SmartAgent:Q4_K_M
- SGLang
How to use mohommed/LFM3-1.7B-Frontier-SmartAgent 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 "mohommed/LFM3-1.7B-Frontier-SmartAgent" \ --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": "mohommed/LFM3-1.7B-Frontier-SmartAgent", "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 "mohommed/LFM3-1.7B-Frontier-SmartAgent" \ --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": "mohommed/LFM3-1.7B-Frontier-SmartAgent", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use mohommed/LFM3-1.7B-Frontier-SmartAgent with Ollama:
ollama run hf.co/mohommed/LFM3-1.7B-Frontier-SmartAgent:Q4_K_M
- Unsloth Desktop
- Pi
How to use mohommed/LFM3-1.7B-Frontier-SmartAgent with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf mohommed/LFM3-1.7B-Frontier-SmartAgent:Q4_K_M
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:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "mohommed/LFM3-1.7B-Frontier-SmartAgent:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use mohommed/LFM3-1.7B-Frontier-SmartAgent with Docker Model Runner:
docker model run hf.co/mohommed/LFM3-1.7B-Frontier-SmartAgent:Q4_K_M
- Lemonade
How to use mohommed/LFM3-1.7B-Frontier-SmartAgent with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull mohommed/LFM3-1.7B-Frontier-SmartAgent:Q4_K_M
Run and chat with the model
lemonade run user.LFM3-1.7B-Frontier-SmartAgent-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use mohommed/LFM3-1.7B-Frontier-SmartAgent with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf mohommed/LFM3-1.7B-Frontier-SmartAgent: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 mohommed/LFM3-1.7B-Frontier-SmartAgent:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use mohommed/LFM3-1.7B-Frontier-SmartAgent with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf mohommed/LFM3-1.7B-Frontier-SmartAgent: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 "mohommed/LFM3-1.7B-Frontier-SmartAgent: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"
- ๐ LFM3-1.7B-Frontier-SmartAgent (512K Context โข 4-Stage Reasoning โข Second Brain Agent)
๐ LFM3-1.7B-Frontier-SmartAgent (512K Context โข 4-Stage Reasoning โข Second Brain Agent)
LFM3-1.7B-Frontier-SmartAgent is an autonomous reasoning, coding, and tool-calling language model built on top of LiquidAI/LFM3-1.7B. It combines Liquid AI's 24-layer Tri-Hybrid architecture (Gated Short Convolutions + Sliding-Window Attention + Global Grouped-Query Attention) with 512K NTK-YaRN context scaling, Gram-Schmidt Damped Mid-Layer Orthogonalization, and a Two-Stage Post-Training Pipeline (Multi-Turn SFT + Multi-Objective GRPO).
Designed specifically for on-device and edge agentic systems, this model natively reasons through a structured 4-Stage Frontier Thinking Protocol (<think>...</think>), audits external context (<context>) and persistent associative memory (<second_brain>), and emits verified executable Python tool calls (<tool_call>...</tool_call>).
โจ Key Architectural Highlights
1. ๐ญ 512K (524,288 Token) NTK-Aware YaRN Context Scaling
Extended 2.0ร from LFM3's native 262,144 context window to 524,288 tokens across both full and sliding-window attention layers using calibrated YaRN RoPE scaling (factor = 2.0, beta_fast = 32.0, beta_slow = 1.0, mscale = 1.14). This preserves high-frequency local positional resolution while enabling repository-scale AST dependency indexing.
2. ๐งญ Gram-Schmidt Damped SVD Orthogonalization (Layers 9โ19)
Rather than applying destructive full-model weight abliterationโwhich degrades small-model perplexity and state-space convolution stabilityโrefusal directions are isolated via Singular Value Decomposition (SVD), orthogonalized against harmless technical reasoning activations via Gram-Schmidt projection, and subtracted exclusively from middle MLP down-projections (w2 / down_proj in layers 9โ19) with a damping coefficient of $\alpha = 0.60$. Early shortconv feature extractors (layers 0โ8) and final output calibration layers (layers 20โ23) remain 100% untouched.
3. ๐ง Mandatory 4-Stage Frontier <think> Protocol
Unlike standard chat models whose chain-of-thought is unstructured or stripped during multi-turn conversations, LFM3-1.7B-Frontier-SmartAgent is trained with preserve_thinking = true to execute a strict 4-step cognitive audit before every action:
[1. CONTEXT & 2ND BRAIN AUDIT]: Inspects<context>,<second_brain>, and<tool_response>to separate verified facts from unknowns.[2. DAG DECOMPOSITION]: Breaks complex goals into an ordered Directed Acyclic Graph (DAG) of atomic tool invocations.[3. HALLUCINATION & CONSTRAINT CHECK]: Verifies every URL, file path, Set-of-Marks ID[#som_id], and function parameter signature against the active context.[4. PRECISION EXECUTION]: Emits syntactically valid Python tool calls or a grounded final Markdown synthesis.
4. ๐ธ๏ธ HippoRAG-2 Associative "Second Brain" & Multi-Hop Deep Research Ready
Trained to operate seamlessly with a persistent bi-temporal Second Brain combining:
- Dense Vector Memory (
FAISS IndexFlatIP) with Maximal Marginal Relevance (MMR) deduplication. - Neuro-Symbolic Knowledge Graph (
NetworkXPersonalized PageRank / PPR) for multi-hop entity association. - Playwright Set-of-Marks (
[#som_id]) Browser Grounding and Voyager-style Dynamic Skill Synthesis.
๐๏ธ Architecture & Training Specifications
| Property | Specification |
|---|---|
| Base Architecture | Lfm3ForCausalLM (Tri-Hybrid: Gated shortconv + Sliding-Window GQA + Full GQA) |
| Parameters | ~1.7 Billion (24 Layers, 2048 Hidden Dim, 7680 SwiGLU FFN Dim) |
| Attention Heads | 16 Query Heads / 4 Key-Value Heads (GQA) on Attention Layers |
| ShortConv Cache | Kernel Size L_cache = 7 |
| Vocabulary Size | 125,050 (Native Byte-Level BPE via PreTrainedTokenizerFast) |
| Max Context Length | 524,288 tokens (512K) via NTK-YaRN (factor=2.0, mscale=1.14) |
| Stage 1 Post-Training | Multi-Turn Supervised Fine-Tuning (SFT) on 4-Stage <think> + <tool_call> trajectories (LoRA r=32, alpha=64, lr=1.5e-4, final loss 0.089) |
| Stage 2 Post-Training | Group Relative Policy Optimization (GRPO) with Dense AST, Signature-Binding & Context-Grounding Rewards (num_generations=4, lr=5e-6) |
๐ Example Model Output (Multi-Turn Agentic Trace)
Turn 1: Autonomous Planning & Tool Execution
<think>
[1. CONTEXT & 2ND BRAIN AUDIT]: <context> indicates the workspace is clean and report.txt is not yet written. <second_brain> lists the target URL https://example.com/.
[2. DAG DECOMPOSITION]:
- Step 1: Call `browser_goto(url='https://example.com')` to extract the live Set-of-Marks DOM.
- Step 2: Call `computer_write_file(filename='report.txt', content=dom_snap)` to persist the DOM.
- Step 3: Call `computer_bash(command='head -n 8 report.txt')` to verify the file on disk.
[3. HALLUCINATION & CONSTRAINT CHECK]: All URLs and filenames are explicit and match tool parameter schemas.
[4. PRECISION EXECUTION]: Emit executable Python inside <tool_call>.
</think>
<tool_call>
dom_snap = browser_goto(url="https://example.com")
write_res = computer_write_file(filename="report.txt", content=dom_snap)
verify_res = computer_bash(command="head -n 8 report.txt")
print(write_res)
print(verify_res)
</tool_call>
Turn 2: Grounded Synthesis After <tool_response>
<think>
[1. CONTEXT & 2ND BRAIN AUDIT]: <tool_response> confirms report.txt (1068 bytes) was written and verified with EXIT 0.
[2. DAG DECOMPOSITION]: All 3 DAG nodes succeeded; no further tool calls required.
[3. HALLUCINATION & CONSTRAINT CHECK]: Cite exact byte count (1068 bytes), page title (Example Domain), and Set-of-Marks [#1].
[4. PRECISION EXECUTION]: Output final verified Markdown summary.
</think>
### Execution Verified
1. **Browser Navigation:** Loaded `https://example.com/` (`Example Domain`).
2. **Second Brain Upgrade:** Saved interactive Set-of-Marks `[#1]` (`<a> "Learn more"`).
3. **File Write:** Persisted `report.txt` โ `1068 bytes`.
4. **Disk Verification:** Confirmed `report.txt` exists (`EXIT 0`).
๐ฆ Available GGUF Quantizations
All GGUF files are hosted in the companion repository: mohommed/LFM3-1.7B-Frontier-SmartAgent-GGUF.
๐ก Quantization Recommendation: Because
LFM3-1.7Bis a compact 1.7B Tri-Hybrid model utilizing stateful gated short-convolution (shortconv) layers,Q8_0(1.84 GiB) orQ6_K(1.42 GiB) is strongly recommended to retain 99.8% of full-precision coding, reasoning, and tool-calling accuracy.
| Filename | Quantization | Size | Best Use Case |
|---|---|---|---|
lfm3-1.7b-frontier-f16.gguf |
F16 |
~3.45 GiB | Uncompressed 16-bit reference weights |
lfm3-1.7b-frontier-q8_0.gguf |
Q8_0 |
~1.84 GiB | โญ Recommended for SOTA Agentic & Coding Quality |
lfm3-1.7b-frontier-q6_k.gguf |
Q6_K |
~1.42 GiB | Near-lossless quality with low memory footprint |
lfm3-1.7b-frontier-q5_k_m.gguf |
Q5_K_M |
~1.22 GiB | Balanced quality and inference speed |
lfm3-1.7b-frontier-q4_k_m.gguf |
Q4_K_M |
~1.02 GiB | Fast CPU / laptop deployment |
lfm3-1.7b-frontier-q3_k_m.gguf |
Q3_K_M |
~0.82 GiB | Ultra-compact mobile & embedded devices |
๐ Quickstart Guide
1. Python (transformers)
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "mohommed/LFM3-1.7B-Frontier-SmartAgent"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
torch_dtype=torch.bfloat16 if torch.cuda.is_bf16_supported() else torch.float16,
device_map="auto",
).eval()
system_prompt = """You are LFM3-1.7B-Frontier, an elite autonomous AI agent equipped with a 512K context window and a Real-Time Second Brain Memory system.
### MANDATORY 4-STAGE THINKING PROTOCOL
Inside `<think>...</think>`, structure your reasoning using:
[1. CONTEXT & 2ND BRAIN AUDIT]
[2. DAG DECOMPOSITION]
[3. HALLUCINATION & CONSTRAINT CHECK]
[4. PRECISION EXECUTION]"""
messages = [
{"role": "system", "content": system_prompt},
{
"role": "user",
"content": (
"<context>Workspace active.</context>\n"
"<second_brain>No cached memories.</second_brain>\n"
"Goal: Write a thread-safe LRU cache in Python with O(1) get and put operations."
),
},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.15,
top_p=0.90,
repetition_penalty=1.08,
do_sample=True,
pad_token_id=tokenizer.eos_token_id,
)
reply = "<think>\n" + tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=False).split("<|im_end|>")[0].strip()
print(reply)
2. Ollama (GGUF)
# Run the recommended 8-bit quantization directly from Hugging Face:
ollama run hf.co/mohommed/LFM3-1.7B-Frontier-SmartAgent-GGUF:Q8_0
# Or run the 4-bit quantization:
ollama run hf.co/mohommed/LFM3-1.7B-Frontier-SmartAgent-GGUF:Q4_K_M
3. llama.cpp CLI
./llama-cli \
-hf mohommed/LFM3-1.7B-Frontier-SmartAgent-GGUF:Q8_0 \
-c 32768 \
--temp 0.15 \
--repeat-penalty 1.08 \
-cnv
๐ก๏ธ Best Practices & Recommended Sampling Parameters
- Temperature:
0.10 โ 0.20(Low temperature keeps AST code generation and tool parameter binding deterministic). - Top-P:
0.90 โ 0.92 - Repetition Penalty:
1.08 - Context Packing: While the architecture supports up to 512K tokens, for single-GPU consumer hardware (8 GBโ16 GB VRAM), pairing the model with FAISS + PageRank MMR retrieval (injecting the top 8Kโ32K highest-signal tokens per turn) maximizes prefill speed and attention sharpness.
๐ License & Citation
This model is released under the Apache-2.0 License, inheriting from LiquidAI/LFM3-1.7B.
@misc{lfm3_frontier_smartagent_2026,
title = {LFM3-1.7B-Frontier-SmartAgent: 512K-Context Hybrid Reasoning and Second-Brain Autonomous Agent},
author = {mohommed},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/mohommed/LFM3-1.7B-Frontier-SmartAgent}}
}
- Downloads last month
- 546