Instructions to use spatialft/LFM2-350M-StepGame-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use spatialft/LFM2-350M-StepGame-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="spatialft/LFM2-350M-StepGame-GGUF", filename="LFM2-350M-StepGame-f16.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use spatialft/LFM2-350M-StepGame-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf spatialft/LFM2-350M-StepGame-GGUF:F16 # Run inference directly in the terminal: llama-cli -hf spatialft/LFM2-350M-StepGame-GGUF:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf spatialft/LFM2-350M-StepGame-GGUF:F16 # Run inference directly in the terminal: llama-cli -hf spatialft/LFM2-350M-StepGame-GGUF:F16
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 spatialft/LFM2-350M-StepGame-GGUF:F16 # Run inference directly in the terminal: ./llama-cli -hf spatialft/LFM2-350M-StepGame-GGUF:F16
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 spatialft/LFM2-350M-StepGame-GGUF:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf spatialft/LFM2-350M-StepGame-GGUF:F16
Use Docker
docker model run hf.co/spatialft/LFM2-350M-StepGame-GGUF:F16
- LM Studio
- Jan
- vLLM
How to use spatialft/LFM2-350M-StepGame-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "spatialft/LFM2-350M-StepGame-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "spatialft/LFM2-350M-StepGame-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/spatialft/LFM2-350M-StepGame-GGUF:F16
- Ollama
How to use spatialft/LFM2-350M-StepGame-GGUF with Ollama:
ollama run hf.co/spatialft/LFM2-350M-StepGame-GGUF:F16
- Unsloth Studio new
How to use spatialft/LFM2-350M-StepGame-GGUF 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 spatialft/LFM2-350M-StepGame-GGUF 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 spatialft/LFM2-350M-StepGame-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for spatialft/LFM2-350M-StepGame-GGUF to start chatting
- Pi new
How to use spatialft/LFM2-350M-StepGame-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf spatialft/LFM2-350M-StepGame-GGUF:F16
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": "spatialft/LFM2-350M-StepGame-GGUF:F16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use spatialft/LFM2-350M-StepGame-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf spatialft/LFM2-350M-StepGame-GGUF:F16
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 spatialft/LFM2-350M-StepGame-GGUF:F16
Run Hermes
hermes
- Docker Model Runner
How to use spatialft/LFM2-350M-StepGame-GGUF with Docker Model Runner:
docker model run hf.co/spatialft/LFM2-350M-StepGame-GGUF:F16
- Lemonade
How to use spatialft/LFM2-350M-StepGame-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull spatialft/LFM2-350M-StepGame-GGUF:F16
Run and chat with the model
lemonade run user.LFM2-350M-StepGame-GGUF-F16
List all available models
lemonade list
llm.create_chat_completion(
messages = [
{
"role": "user",
"content": "What is the capital of France?"
}
]
)LFM2-350M-StepGame (GGUF)
Fine-tuned LiquidAI/LFM2-350M on the StepGame spatial reasoning benchmark. The model answers directional relationship questions (left, right, above, below, upper-left, upper-right, lower-left, lower-right) given a sequence of positional statements.
Results
| Metric | Baseline | Fine-tuned | Delta |
|---|---|---|---|
| Overall | 16.0% | 74.4% | +58.4 |
| 1-hop | 24.0% | 94.0% | +70.0 |
| 2-hop | 14.0% | 90.0% | +76.0 |
| 3-hop | 14.0% | 76.0% | +62.0 |
| 4-hop | 18.0% | 54.0% | +36.0 |
| 5-hop | 10.0% | 58.0% | +48.0 |
Evaluated on 250 held-out examples (50 per hop level) from the StepGame validation split.
How to use
llama.cpp / llama-server
llama-server \
--model LFM2-350M-StepGame-f16.gguf \
--ctx-size 8192 \
--host 0.0.0.0 --port 8080
llama-cpp-python
from llama_cpp import Llama
llm = Llama(model_path="LFM2-350M-StepGame-f16.gguf", n_ctx=8192)
output = llm.create_chat_completion(messages=[
{"role": "system", "content": (
"You are a spatial reasoning assistant. "
"Given a sequence of positional relationships between objects, "
"determine the spatial relationship between two specified objects. "
"Answer with a single direction from: "
"left, right, above, below, upper-left, upper-right, lower-left, lower-right."
)},
{"role": "user", "content": (
"J and A are in a vertical line with A below J.\n\n"
"What is the relation of the agent A to the agent J?"
)},
])
print(output["choices"][0]["message"]["content"])
# => "below"
Training details
| Parameter | Value |
|---|---|
| Base model | LiquidAI/LFM2-350M |
| Method | LoRA (PEFT) |
| Rank (r) | 16 |
| Alpha | 32 |
| Dropout | 0.05 |
| Target modules | q_proj, k_proj, v_proj, w1, w2, w3, in_proj, out_proj |
| Training examples | 10,000 (2,000 per hop level, stratified) |
| Epochs | 3 |
| Learning rate | 2e-4 |
| Batch size | 2 (x8 gradient accumulation) |
| Optimizer | paged_adamw_8bit |
| Quantization | QLoRA (NF4, double quant) |
| Final loss | 0.2033 |
| Training time | ~77 min (Colab T4) |
GGUF details
| File | Quant | Size |
|---|---|---|
LFM2-350M-StepGame-f16.gguf |
F16 | 679 MB |
Produced by merging the LoRA adapter into the base model, then converting with llama.cpp convert_hf_to_gguf.py.
Dataset
Training and evaluation data come from different splits of ZhengyanShi/StepGame:
- Training: 10,000 examples from the
trainsplit (stratified, 2,000 per k-hop level) - Evaluation: 250 examples from the
validationsplit (stratified, 50 per k-hop level)
Examples with the "overlap" label were filtered out. Only the 8 cardinal/intercardinal directions are used.
Prompt format
The model uses ChatML-style prompts (<|im_start|>/<|im_end|> tokens):
<|im_start|>system
You are a spatial reasoning assistant. Given a sequence of positional relationships between objects, determine the spatial relationship between two specified objects. Answer with a single direction from: left, right, above, below, upper-left, upper-right, lower-left, lower-right.<|im_end|>
<|im_start|>user
{story}
{question}<|im_end|>
<|im_start|>assistant
Source
Project repository: spatialft/spatialft.github.io
Built for AIPI 590.03 Intelligent Agents (Duke University).
- Downloads last month
- 15
16-bit
Model tree for spatialft/LFM2-350M-StepGame-GGUF
Base model
LiquidAI/LFM2-350MDataset used to train spatialft/LFM2-350M-StepGame-GGUF
Evaluation results
- Overall Accuracy on StepGame (validation split)validation set self-reported74.400
- 1-hop Accuracy on StepGame (validation split)validation set self-reported94.000
- 2-hop Accuracy on StepGame (validation split)validation set self-reported90.000
- 3-hop Accuracy on StepGame (validation split)validation set self-reported76.000
- 4-hop Accuracy on StepGame (validation split)validation set self-reported54.000
- 5-hop Accuracy on StepGame (validation split)validation set self-reported58.000
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="spatialft/LFM2-350M-StepGame-GGUF", filename="LFM2-350M-StepGame-f16.gguf", )