Instructions to use langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2") model = AutoModelForCausalLM.from_pretrained("langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2", 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 langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2 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 langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_M # Run inference directly in the terminal: llama cli -hf langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_M # Run inference directly in the terminal: llama cli -hf langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_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 langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_M # Run inference directly in the terminal: ./llama-cli -hf langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_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 langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_M
Use Docker
docker model run hf.co/langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_M
- LM Studio
- Jan
- vLLM
How to use langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_M
- SGLang
How to use langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2 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 "langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2" \ --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": "langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2", "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 "langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2" \ --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": "langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2 with Ollama:
ollama run hf.co/langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_M
- Unsloth Studio
How to use langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2 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 langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2 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 langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2 to start chatting
- Pi
How to use langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2 with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_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": "langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2 with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_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 langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_M
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2 with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_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 "langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_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 langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2 with Docker Model Runner:
docker model run hf.co/langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_M
- Lemonade
How to use langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_M
Run and chat with the model
lemonade run user.qmd-query-expansion-lfm2.5-1.2b-instruct-v2-Q5_K_M
List all available models
lemonade list
Install from WinGet (Windows)
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama serve -hf langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_M# Run inference directly in the terminal:
llama cli -hf langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_MUse 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 langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_M# Run inference directly in the terminal:
./llama-cli -hf langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_MBuild 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 langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_M# Run inference directly in the terminal:
./build/bin/llama-cli -hf langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_MUse Docker
docker model run hf.co/langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_Mlangleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2
LiquidAI/LFM2.5-1.2B-Instruct fine-tuned with LoRA for QMD query expansion using the v2 data recipe. This repository contains the merged BF16 Transformers checkpoint at its root and QMD-ready GGUF quantizations alongside it.
Repository formats
- Merged BF16 Transformers checkpoint: load the repository directly with
AutoModelForCausalLM.from_pretrained("langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2", torch_dtype=torch.bfloat16). - GGUF for QMD/llama.cpp:
qmd-query-expansion-lfm2.5-1.2b-instruct-q5_k_m.gguf
The BF16 checkpoint is the unquantized merged fine-tune. The GGUF files are derived from that same merged checkpoint.
Artifact validated by this publishing invocation
- File:
qmd-query-expansion-lfm2.5-1.2b-instruct-q5_k_m.gguf - Kind: GGUF
- Size: 843,354,528 bytes
- SHA-256:
12cdc31cb1848cd1bd6b8dbf07c57339c5e2555550598e8469814837e5351c88 - Base model:
LiquidAI/LFM2.5-1.2B-Instruct - Base revision:
868df74dd56ff8a0c2ac5dbf281690c2dbebe4c9 - Dataset:
tobil/qmd-query-expansion-train-v2 - Dataset revision:
9b9c3dd41a11209f3ce907908f9b865f0ead415e - Configured release quantizations: Q5_K_M
- Evaluation report:
q5_k_m
Prompt and behavior
/no_think Expand this search query: {query}
This variant supports the production v2 QMD behavior:
an optional Query intent: line and /only:lex, /only:vec, and /only:hyde
directives.
Each emitted line begins with lex:, vec:, or hyde:.
Use with QMD
The Transformers checkpoint is not loaded by QMD directly; select one of the GGUF files.
For a private repository, authenticate once with hf auth login, or set
HF_TOKEN. QMD's node-llama-cpp downloader reads the cached Hugging Face
token from ~/.cache/huggingface/token by default.
export QMD_GENERATE_MODEL="hf:langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2/qmd-query-expansion-lfm2.5-1.2b-instruct-q5_k_m.gguf"
qmd query --json --explain --no-rerank "docker container shutdown timeout"
Training-data provenance
Training records were rebuilt from the pinned dataset's
messages field with the target LFM2.5 tokenizer. The dataset's preformatted
Qwen text was not used. Completion-only loss masked the user prompt.
Validation
- Average QMD reward: 94.42%
- Format compliance: 99.68%
- Entity preservation: 96.61%
/only:*behavior: 100.00%- Hard failures: 0
BF16 and GGUF comparison
| Format | Avg reward | Δ vs BF16 | Format compliance | Entity | /only:* |
|---|---|---|---|---|---|
| BF16 | 94.47% | baseline | 100.00% | 96.61% | 100.00% |
| Q5_K_M | 94.42% | -0.05 pp | 99.68% | 96.61% | 100.00% |
Quality changes are reported in percentage points (pp), not relative percent. Small positive GGUF deltas can occur because sampled generation is not bit-for-bit deterministic.
- BF16 (batched Transformers): approximately 406.9 output tokens/s and 4.04 examples/s.
- Q5_K_M (GGUF evaluation): approximately 126.1 output tokens/s and 1.28 examples/s.
Speed percentages are intentionally not reported. BF16 was measured with batched Transformers inference, while QMD runs GGUF through llama.cpp one query at a time. Their observed throughput and latency are useful operational measurements, but dividing them would not be an apples-to-apples speedup.
Credits
- Liquid AI for LFM2.5 and the LFM Open License v1.0.
- Tobi for QMD, the QMD query-expansion datasets, evaluation/scoring design, and the Qwen3 query-expansion model.
- OrcsRise for the earlier LFM2 QMD fine-tuning work that informed the LFM target-module recipe.
- QMD, TRL, PEFT, and llama.cpp.
Licensing and dataset notice
This derivative is governed by the LFM Open License v1.0. The included
LICENSE must be retained, including its attribution and commercial-use terms.
The upstream QMD dataset card did not declare an explicit dataset license at the pinned revision. This repository records that fact and does not imply that a license was granted. Users and redistributors are responsible for confirming that their use is authorized.
- Downloads last month
- 139
Model tree for langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2
Base model
LiquidAI/LFM2.5-1.2B-Base
Install (macOS, Linux)
# Start a local OpenAI-compatible server with a web UI: llama serve -hf langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_M# Run inference directly in the terminal: llama cli -hf langleu/qmd-query-expansion-lfm2.5-1.2b-instruct-v2:Q5_K_M