Instructions to use madscience75/LFM3-AA1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use madscience75/LFM3-AA1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="madscience75/LFM3-AA1", 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("madscience75/LFM3-AA1", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("madscience75/LFM3-AA1", 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 madscience75/LFM3-AA1 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 madscience75/LFM3-AA1:BF16 # Run inference directly in the terminal: llama cli -hf madscience75/LFM3-AA1:BF16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf madscience75/LFM3-AA1:BF16 # Run inference directly in the terminal: llama cli -hf madscience75/LFM3-AA1:BF16
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 madscience75/LFM3-AA1:BF16 # Run inference directly in the terminal: ./build/bin/llama cli -hf madscience75/LFM3-AA1:BF16
Use Docker
docker model run hf.co/madscience75/LFM3-AA1:BF16
- Llama new
- LM Studio
- Jan
- vLLM
How to use madscience75/LFM3-AA1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "madscience75/LFM3-AA1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "madscience75/LFM3-AA1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/madscience75/LFM3-AA1:BF16
- SGLang
How to use madscience75/LFM3-AA1 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 "madscience75/LFM3-AA1" \ --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": "madscience75/LFM3-AA1", "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 "madscience75/LFM3-AA1" \ --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": "madscience75/LFM3-AA1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use madscience75/LFM3-AA1 with Ollama:
ollama run hf.co/madscience75/LFM3-AA1:BF16
- Unsloth Desktop
- Pi
How to use madscience75/LFM3-AA1 with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf madscience75/LFM3-AA1:BF16
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": "madscience75/LFM3-AA1:BF16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use madscience75/LFM3-AA1 with Docker Model Runner:
docker model run hf.co/madscience75/LFM3-AA1:BF16
- Lemonade
How to use madscience75/LFM3-AA1 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull madscience75/LFM3-AA1:BF16
Run and chat with the model
lemonade run user.LFM3-AA1-BF16
List all available models
lemonade list
- Hermes Agent
How to use madscience75/LFM3-AA1 with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf madscience75/LFM3-AA1:BF16
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 madscience75/LFM3-AA1:BF16
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use madscience75/LFM3-AA1 with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf madscience75/LFM3-AA1:BF16
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 "madscience75/LFM3-AA1:BF16" \ --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-AA1 (LFM3 Abreviated Answer)
- Available Formats & SHA256 Checksums
- Benchmark Comparisons
- 1. Standard Math Benchmarks (Kaggle 2รT4, BF16,
do_sample=False,max_new_tokens=2048) - 2. Locked Holdout Suite (
final_holdout_locked.json, 24 Oracle-Verified Tasks) - 3. Dev Eval Suite (
dev_eval_tasks.json, 24 Oracle-Verified Tasks) - 4. Paired Local Agentic Suite (
Q8_0, 4096 Total Tokens / Run) - 5. Abliteration Preservation Spot-Check (
Q8_0)
- 1. Standard Math Benchmarks (Kaggle 2รT4, BF16,
- Exact Reproducible Recipe
- Usage (
llama-server/llama.cpp)
- Available Formats & SHA256 Checksums
LFM3-AA1 (LFM3 Abreviated Answer)
LFM3-AA1 (LFM3 Abreviated Answer) is a reasoning-compressed, abliterated 1.7B-parameter language model built on top of Peymandc/LFM3-1.7B-Heretic-Uncensored (itself derived from LiquidAI/LFM3-1.7B).
Using pure-DPO preference optimization on self-generated oracle-verified reasoning traces (56 pairs, beta=0.1, 3 epochs), LFM3-AA1 cuts reasoning token usage by 43โ44% on structured reasoning tasks (and 13โ31% on GSM8K / MATH-500) while recovering +3% on GSM8K (88% -> 91%) and +6% on MATH-500 (60% -> 66%) over the abliterated base model, achieving 0 regressions, 0 token-cap failures on holdout reasoning, -31.9% tokens on multi-turn agentic tasks, and 0/2 refusals on abliteration spot-checks.
- GitHub Repository & Reproducible Scripts:
ronasimi/lfm3-aa1 - Hugging Face Repository:
madscience75/LFM3-AA1
Available Formats & SHA256 Checksums
| Artifact | Format | Size | SHA256 |
|---|---|---|---|
model.safetensors (download) |
BF16 Safetensors | 3.46 GB | 01a2607387459570a16c869d95123c39faefe953aa05738c671ca4a40a83d8b2 |
LFM3-AA1-BF16.gguf (download) |
BF16 GGUF | 3.47 GB (3.3 GiB) | 5af1664f5b79f465a9727194ead902baeaf4d000fdd9aa86c53530c440752340 |
LFM3-AA1-Q8_0.gguf (download) |
Q8_0 GGUF | 1.85 GB (1.8 GiB) | cc2962c4c6ed6bfb7f11fef842d862a3d8928206b21d8265b3f1867bd3f78726 |
LFM3-AA1-IQ4_XS.gguf (download) |
IQ4_XS GGUF (imatrix, 4.61 BPW) | 1.00 GB (949.43 MiB) | f70caafff6b7eff95536ae2913a9901fdcdc03cc72f1bd2a86758a2c162adbaf |
All model files (config.json, tokenizer.json, chat_template.jinja, modeling files, and GGUFs) are hosted in the madscience75/LFM3-AA1 file tree.
Benchmark Comparisons
1. Standard Math Benchmarks (Kaggle 2รT4, BF16, do_sample=False, max_new_tokens=2048)
Evaluated with aa1_std_bench.py on the first 100 problems of GSM8K (openai/gsm8k, test) and MATH-500 (HuggingFaceH4/MATH-500, test).
| Model | GSM8K Pass | GSM8K Caps | GSM8K Mean / Med rtok | MATH-500 Pass | MATH-500 Caps | MATH-500 Mean / Med rtok |
|---|---|---|---|---|---|---|
LiquidAI/LFM3-1.7B (Stock) |
92/100 (92.0%) | 4 | 603.4 / 392.5 | 69/100 (69.0%) | 24 | 889.9 / 594.5 |
Peymandc/LFM3-1.7B-Heretic-Uncensored (Base) |
88/100 (88.0%) | 8 | 711.2 / 457.5 | 60/100 (60.0%) | 36 | 1064.2 / 771.0 |
LFM3-AA1 (Ours, BF16) |
91/100 (91.0%) | 2 | 493.3 / 345.0 | 66/100 (66.0%) | 29 | 926.3 / 535.0 |
Delta vs. Abliterated Base (Peymandc/LFM3-1.7B-Heretic-Uncensored):
- GSM8K: +3.0% accuracy (
88% -> 91%), -6 caps, -30.6% mean reasoning tokens (711.2 -> 493.3), -24.6% median reasoning tokens (457.5 -> 345.0). - MATH-500: +6.0% accuracy (
60% -> 66%), -7 caps, -13.0% mean reasoning tokens (1064.2 -> 926.3), -30.6% median reasoning tokens (771.0 -> 535.0).
Delta vs. Stock (LiquidAI/LFM3-1.7B):
- GSM8K: Within 1 point of stock (
91%vs92%) with fewer caps (2vs4) and -18.2% mean / -12.1% median reasoning tokens. - MATH-500: -10.0% median reasoning tokens (
594.5 -> 535.0) while retaining66%accuracy and uncensored behavior.
(Note: aa1_std_bench.py also included a 5-prompt tool_calling check, which scored 0/5 across all three models โ Stock, Base, and LFM3-AA1 โ because the harness looked for OpenAI-style {"arguments": ...} JSON rather than LFM3's native <|tool_call_start|>[...]<|tool_call_end|> syntax.)
2. Locked Holdout Suite (final_holdout_locked.json, 24 Oracle-Verified Tasks)
Evaluated across 4 task families (math_seq, schedule_time, state_ops, prefix_recovery) with max_new_tokens=4096.
| Model / Quant | Pass | Caps | Total Reasoning Tokens | Aggregate rtok Delta | Median rtok Delta |
|---|---|---|---|---|---|
Base Heretic-Uncensored (BF16) |
24/24 | 0 | 35,974 | โ | โ |
LFM3-AA1 (BF16.gguf) |
24/24 | 0 | 20,514 | -42.98% | -39.52% |
LFM3-AA1 (Q8_0.gguf) |
24/24 | 0 | 20,258 | -43.69% | -42.98% |
LFM3-AA1 (IQ4_XS.gguf, 4.61 BPW) |
22/24 | 0 | 25,402 | -29.39% | -24.96% |
(On IQ4_XS, 2 tasks โ final-s2 and final-a3 โ missed due to 4-bit quantization noise; BF16 and Q8_0 achieved 24/24.)
3. Dev Eval Suite (dev_eval_tasks.json, 24 Oracle-Verified Tasks)
| Model | Pass | Regressions | Caps | Passing Reasoning Tokens | Aggregate rtok Delta | Median rtok Delta |
|---|---|---|---|---|---|---|
Base Heretic-Uncensored (BF16) |
22/24 | โ | 0 | 30,516 | โ | โ |
LFM3-AA1 (BF16) |
22/24 | 0 | 0 | 17,958 | -41.15% | -44.27% |
4. Paired Local Agentic Suite (Q8_0, 4096 Total Tokens / Run)
Evaluated locally via llama-server on 3 multi-step agentic tasks (clamp, schedule, follow_pointer).
Model (Q8_0) |
Rubric Score | Full Pass | Total Tokens | Caps | Breakdown (clamp / schedule / follow_pointer) |
|---|---|---|---|---|---|
Base Heretic-Uncensored |
9/12 | 0/3 | 7,377 | 1 | 3/4 cap 4096 / 3/4 2443 tok / 3/4 838 tok |
LFM3-AA1 |
10/12 | 1/3 | 5,025 (-31.9%) | 0 | 4/4 915 tok / 3/4 3294 tok / 3/4 816 tok |
5. Abliteration Preservation Spot-Check (Q8_0)
Tested on 2 standard abliteration verification prompts (abliteration_spotcheck.json):
- Refusals:
0/2(refused: falseon both prompts).
Exact Reproducible Recipe
1. Base Model & Environment
- Base Model:
Peymandc/LFM3-1.7B-Heretic-Uncensored - Pinned Revision:
72c1fa3b225c4663f9de0a682d6909cc14599125 - Base
model.safetensorsSHA256:833e0f1994c6809a728f6698735a00fc8643e974c64284b7bd7853d1dfb9b29b - Special Token IDs:
THINK_END = 124902,EOS_ID = 124900
2. Synthetic Task Splits & Rollout Collection (generate_tasks.py, aa1_phase1_worker.py, build_dpo_pairs.py)
- Generated 3 non-overlapping oracle-verified splits across
math_seq,schedule_time,state_ops, andprefix_recovery:dev_train_tasks.json(120 tasks, SHA256:e12a9ed057ad8bfbef3ee0b0e6fddb6ae07d1611e2da2db3ca55980d6816de5b)dev_eval_tasks.json(24 tasks, SHA256:be0f53f04cdbe815510b4dfe715970672d941e4ea07d5b029a260318da4ff6ea)final_holdout_locked.json(24 tasks, SHA256:69cd59fc552c1b6308eea7a527ce7f1927031288c9c2e7d9d6d2b4212c3ed8b5)
- Collected 6 rollouts per training task (
720total rollouts across 3 Kaggle T4 workers;106/120tasks passing). - Constructed shortest-correct vs. longest-correct DPO preference pairs (
build_dpo_pairs.py). The winning training run (dpo_beta01_ep3) used the56preference pairs from the first 2 rollout shards.
3. Pure-DPO LoRA Training (aa1_phase2_trainer.py)
Trained on Kaggle (NvidiaTeslaT4, BF16) with PEFT LoRA:
- LoRA Config:
r=16,lora_alpha=32,lora_dropout=0.05,bias="none",task_type="CAUSAL_LM",target_modules=["q_proj", "k_proj", "v_proj", "o_proj", "w1", "w2", "w3"] - DPO Hyperparameters:
pairs:56beta:0.1sft_weight:0.0(pure DPO; adding SFT weight degraded agenticscheduleperformance)epochs:3lr:5e-5(AdamW,weight_decay=0.01,clip_grad_norm_=1.0)grad_accum:8max_len:1536
- Merge:
model.merge_and_unload()in BF16.
4. GGUF Conversion & Quantization (llama.cpp)
Converted and quantized using llama.cpp (convert_hf_to_gguf.py commit b1b770d90d94cad9e9ea5b993bdbc383a522fb28, transformers==5.21.0):
# 1. Convert merged BF16 Hugging Face model to BF16 GGUF
python convert_hf_to_gguf.py merged_model --outfile LFM3-AA1-BF16.gguf --outtype bf16
# 2. Quantize to Q8_0
llama-quantize LFM3-AA1-BF16.gguf LFM3-AA1-Q8_0.gguf Q8_0
# 3. Generate importance matrix and quantize to IQ4_XS
llama-imatrix -m LFM3-AA1-BF16.gguf -f calibration.txt -o imatrix.dat --chunks 64
llama-quantize --imatrix imatrix.dat LFM3-AA1-BF16.gguf LFM3-AA1-IQ4_XS.gguf IQ4_XS
Usage (llama-server / llama.cpp)
llama-server \
-m LFM3-AA1-Q8_0.gguf \
--alias lfm-aa1 \
--ctx-size 32768 \
--jinja
- Downloads last month
- 751
Model tree for madscience75/LFM3-AA1
Base model
LiquidAI/LFM3-1.7B-Base