Safetensors
GGUF
English
Russian
lfm3
reasoning
test-time-compute
inference-time-scaling
code-generation
llama.cpp
negative-results
conversational
Instructions to use HelioAI/LFM3-1.7B-inference-modules-experiments with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use HelioAI/LFM3-1.7B-inference-modules-experiments 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 HelioAI/LFM3-1.7B-inference-modules-experiments:Q5_K_M # Run inference directly in the terminal: llama cli -hf HelioAI/LFM3-1.7B-inference-modules-experiments:Q5_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf HelioAI/LFM3-1.7B-inference-modules-experiments:Q5_K_M # Run inference directly in the terminal: llama cli -hf HelioAI/LFM3-1.7B-inference-modules-experiments:Q5_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 HelioAI/LFM3-1.7B-inference-modules-experiments:Q5_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf HelioAI/LFM3-1.7B-inference-modules-experiments:Q5_K_M
Use Docker
docker model run hf.co/HelioAI/LFM3-1.7B-inference-modules-experiments:Q5_K_M
- Llama new
- LM Studio
- Jan
- Ollama
How to use HelioAI/LFM3-1.7B-inference-modules-experiments with Ollama:
ollama run hf.co/HelioAI/LFM3-1.7B-inference-modules-experiments:Q5_K_M
- Unsloth Desktop
- Pi
How to use HelioAI/LFM3-1.7B-inference-modules-experiments with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf HelioAI/LFM3-1.7B-inference-modules-experiments:Q5_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": "HelioAI/LFM3-1.7B-inference-modules-experiments:Q5_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use HelioAI/LFM3-1.7B-inference-modules-experiments with Docker Model Runner:
docker model run hf.co/HelioAI/LFM3-1.7B-inference-modules-experiments:Q5_K_M
- Lemonade
How to use HelioAI/LFM3-1.7B-inference-modules-experiments with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull HelioAI/LFM3-1.7B-inference-modules-experiments:Q5_K_M
Run and chat with the model
lemonade run user.LFM3-1.7B-inference-modules-experiments-Q5_K_M
List all available models
lemonade list
- Hermes Agent
How to use HelioAI/LFM3-1.7B-inference-modules-experiments with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf HelioAI/LFM3-1.7B-inference-modules-experiments: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 HelioAI/LFM3-1.7B-inference-modules-experiments:Q5_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use HelioAI/LFM3-1.7B-inference-modules-experiments with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf HelioAI/LFM3-1.7B-inference-modules-experiments: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 "HelioAI/LFM3-1.7B-inference-modules-experiments: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"
Download research/scripts/prep_train.py from HelioAI/LFM3-1.7B-inference-modules-experiments: direct link, hf CLI and curl.
- Browser
- Download file 5.31 kB
-
https://huggingface.co/HelioAI/LFM3-1.7B-inference-modules-experiments/resolve/main/research/scripts/prep_train.py
- Command line
-
hf download hf://HelioAI/LFM3-1.7B-inference-modules-experiments/research/scripts/prep_train.py
-
curl -L -o prep_train.py https://huggingface.co/HelioAI/LFM3-1.7B-inference-modules-experiments/resolve/main/research/scripts/prep_train.py
5.31 kB
| """Builds the pool of verifiable training problems (math with reference answers, code with unit tests), | |
| decontaminated against every prompt in the frozen eval suite (13-gram overlap on normalized text). | |
| Output: data/train/pool_math.jsonl, data/train/pool_code.jsonl, data/train/dev.jsonl (held-out dev set used for | |
| all intermediate decisions, so the test suite is only touched for the baseline and the final comparison). | |
| """ | |
| import glob | |
| import json | |
| import os | |
| import random | |
| import re | |
| from datasets import load_dataset | |
| ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..") | |
| OUT = os.path.join(ROOT, "data", "train") | |
| os.makedirs(OUT, exist_ok=True) | |
| rng = random.Random(7) | |
| MATH_SUFFIX = "\n\nPlease reason step by step, and put your final answer within \\boxed{}." | |
| def words(s): | |
| return re.sub(r"[^a-z0-9 ]", " ", s.lower()).split() | |
| def ngrams(s, n=13): | |
| w = words(s) | |
| return {" ".join(w[i:i + n]) for i in range(max(0, len(w) - n + 1))} or ({" ".join(w)} if w else set()) | |
| eval_grams = set() | |
| eval_short = set() | |
| for path in glob.glob(os.path.join(ROOT, "data", "eval", "*.jsonl")): | |
| with open(path, encoding="utf-8") as f: | |
| for l in f: | |
| r = json.loads(l) | |
| text = r.get("code_prompt") or r["prompt"].replace(MATH_SUFFIX, "") | |
| eval_grams |= ngrams(text) | |
| eval_short.add(" ".join(words(text))[:200]) | |
| def contaminated(text): | |
| if " ".join(words(text))[:200] in eval_short: | |
| return True | |
| return bool(ngrams(text) & eval_grams) | |
| def last_boxed(text): | |
| idx = text.rfind("\\boxed") | |
| if idx < 0: | |
| return None | |
| i = text.find("{", idx) | |
| depth = 0 | |
| for j in range(i, len(text)): | |
| depth += text[j] == "{" | |
| depth -= text[j] == "}" | |
| if depth == 0: | |
| return text[i + 1: j] | |
| return None | |
| math_rows, seen, dropped = [], set(), 0 | |
| def add_math(src, problem, answer, level=None): | |
| global dropped | |
| if not answer or len(answer) > 60 or "\\text{" in answer and len(answer) > 25: | |
| return # keep answers that a symbolic checker can verify reliably | |
| key = " ".join(words(problem))[:300] | |
| if key in seen: | |
| return | |
| seen.add(key) | |
| if contaminated(problem): | |
| dropped += 1 | |
| return | |
| math_rows.append({"id": f"{src}/{len(math_rows)}", "task": "math", "src": src, "level": level, | |
| "prompt": problem.strip() + MATH_SUFFIX, "answer": answer.strip()}) | |
| ds = load_dataset("DigitalLearningGmbH/MATH-lighteval", split="train") | |
| for r in ds: | |
| lvl = int(r["level"].split()[-1]) if r["level"].split()[-1].isdigit() else None | |
| if lvl and lvl >= 3: | |
| add_math("math_train", r["problem"], last_boxed(r["solution"]), lvl) | |
| n_math = len(math_rows) | |
| ds = load_dataset("agentica-org/DeepScaleR-Preview-Dataset", split="train") | |
| for r in ds: | |
| add_math("deepscaler", r["problem"], r["answer"]) | |
| print(f"math: {n_math} from MATH train, {len(math_rows) - n_math} from DeepScaleR, dropped {dropped} contaminated") | |
| code_rows, dropped_code = [], 0 | |
| ds = load_dataset("google-research-datasets/mbpp", "full") | |
| for split in ("train", "validation", "prompt"): | |
| for r in ds[split]: | |
| if contaminated(r["text"]): | |
| dropped_code += 1 | |
| continue | |
| code_rows.append({ | |
| "id": f"mbpp_train/{r['task_id']}", "task": "code_fn", "src": "mbpp_train", | |
| "prompt": r["text"].strip() + "\nYour code should pass this test:\n" + r["test_list"][0] | |
| + "\n\nWrite the solution as a Python function in a single ```python code block.", | |
| "test": "\n".join(r["test_setup_code"].splitlines() + r["test_list"] + r.get("challenge_test_list", []))}) | |
| n_mbpp = len(code_rows) | |
| ds = load_dataset("likaixin/TACO-verified", split="train") | |
| for r in ds: | |
| q = r["question"] | |
| if len(q) > 6000 or contaminated(q): | |
| dropped_code += 1 | |
| continue | |
| try: | |
| io = json.loads(r["input_output"]) | |
| except Exception: | |
| continue | |
| if io.get("fn_name") or not io.get("inputs") or len(io["inputs"]) < 2: | |
| continue # keep stdin/stdout problems with at least two tests | |
| if any(not isinstance(x, str) for x in io["inputs"] + io["outputs"]): | |
| continue | |
| if sum(len(x) for x in io["inputs"]) > 200_000: | |
| continue | |
| code_rows.append({ | |
| "id": f"taco/{r['id'] if 'id' in r else len(code_rows)}", "task": "code_io", "src": "taco", | |
| "difficulty": r.get("difficulty"), | |
| "prompt": q.strip() + "\n\nWrite a Python 3 program that reads from standard input and writes to standard " | |
| "output. Put the complete program in a single ```python code block.", | |
| "inputs": io["inputs"][:20], "outputs": io["outputs"][:20]}) | |
| print(f"code: {n_mbpp} MBPP, {len(code_rows) - n_mbpp} TACO, dropped {dropped_code} contaminated/long") | |
| rng.shuffle(math_rows) | |
| rng.shuffle(code_rows) | |
| # dev: 300 math + 150 code problems, never trained on, used for every intermediate decision | |
| dev = math_rows[:300] + code_rows[:150] | |
| for name, rows in [("dev", dev), ("pool_math", math_rows[300:]), ("pool_code", code_rows[150:])]: | |
| with open(os.path.join(OUT, f"{name}.jsonl"), "w", encoding="utf-8") as f: | |
| for r in rows: | |
| f.write(json.dumps(r, ensure_ascii=False) + "\n") | |
| print(name, len(rows)) | |