coder-lfm3-1.7b-k3.1-pro

LFM3-1.7B fine-tuned on the Coder profile of a corpus generated by moonshotai/kimi-k3.1-pro (OpenRouter, canonical moonshotai/kimi-k3.1-pro-20261023).

The teacher's traces are long normative reasoning followed by a fenced implementation; this adapter moves LFM3 toward that shape for code and CS prompts.

Training

base LiquidAI/LFM3-1.7B, MLX 4-bit conversion
data AJ-Gonzalez/coder-kimi-k3.1-pro-lfm3 โ€” 69 rows โ†’ 289 train / 34 valid chunks
chunking 2048 tokens, 256-token replay, one example per chunk
LoRA rank 8, 8 layers, 2.753M trainable (0.159%)
batch / seq 1 / 2048
optimizer Adam, lr 1e-5
schedule 3 epochs = 867 iters, save + eval every 289
memory --grad-checkpoint (mandatory at seq 2048 on 8 GB)
wall time 2.96 h on M1 8 GB

Validation loss: 2.861 โ†’ 2.581 โ†’ 2.594 โ†’ 2.438. The final epoch was the best, so adapters/adapters.safetensors is the keeper.

Files

  • model.safetensors โ€” 4-bit MLX weights, 946 MB, 4.503 bits/weight.
  • adapters/ โ€” the LoRA adapter (11 MB) for re-fusing or further training.

The bf16 merged model is not included; regenerate it with:

mlx_lm.fuse --model LiquidAI/LFM3-1.7B --adapter-path adapters \
    --save-path coder-lfm3-1.7b-k3.1-pro --dequantize

Usage

mlx_lm.generate --model AJ-Gonzalez/coder-lfm3-1.7b-k3.1-pro \
    --prompt "Write a Python function that returns the first 12 prime numbers, with a one-line docstring." \
    --max-tokens 3000

The LFM3 chat template is applied by default. On M1 8 GB: 46โ€“48 tok/s, 1.19 GB peak.

Sample (greedy, 3000 tokens; the trace self-corrects a bad first draft):

def first_12_primes():
    """Return the first 12 prime numbers."""
    primes = []
    candidate = 2
    while len(primes) < 12:
        is_prime = True
        for p in primes:
            if p * p > candidate:
                break
            if candidate % p == 0:
                is_prime = False
                break
        if is_prime:
            primes.append(candidate)
        candidate += 1
    return primes

How the data was made

The generator and the full recipe are in the dataset card. In short:

  1. openrouter_reasoning_corpus.py regenerates the MiMo prompts with any OpenRouter teacher (gist: https://gist.github.com/AJ-Gonzalez/31f1f8cfe45c233911e055d5cfed6da0).
  2. build_profile_dataset.py coder --source corpus.jsonl renders with the LFM3 template and chunks to 2048/256.

GGUF

coder-lfm3-1.7b-k3.1-pro-Q4_K_M.gguf โ€” 1.1 GB, 5.05 bits/weight, SHA-256 31206a46f468afbcb9147ddde78be4335840acbf8ef8e713f5369d78620020c1.

llama-cli -m coder-lfm3-1.7b-k3.1-pro-Q4_K_M.gguf \
    -p "Write a Python function that returns the first 12 prime numbers." -n 96

Q4_K_M decodes at ~37.6 tok/s on M1 (96-token smoke, not a benchmark). The f16 intermediate (3.3 GB) is not uploaded; regenerate it with tools/llama.cpp/convert_hf_to_gguf.py --outtype f16 from the fused bf16, then llama-quantize ... Q4_K_M.

License and attribution

  • Base model: LiquidAI/LFM3-1.7B, LFM Open License v1.0. A copy is included here as LICENSE. Redistribution must keep that copy, mark modified files, and retain the upstream attribution notices.
  • Commercial use: permitted only while the licensee's legal entity stays below the license's $10M annual-revenue threshold; above it this model is not licensed for commercial use.
  • Data: AJ-Gonzalez/coder-kimi-k3.1-pro-lfm3. Prompts come from xtools-at/Xiaomi-MiMo-2.6-Pro-High-Reasoning-250x, itself sourced from TeichAI/claude-4.5-opus-high-reasoning-250x. Responses were generated by moonshotai/kimi-k3.1-pro via OpenRouter. Those upstream terms apply to the traces; this model is released for research/distillation consistent with them.
  • No warranty. Provided as-is; the author is not liable for downstream use.
Downloads last month
695
Safetensors
Model size
2B params
Tensor type
U32
ยท
BF16
ยท
MLX
Hardware compatibility
Log In to add your hardware

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for AJ-Gonzalez/coder-lfm3-1.7b-k3.1-pro

Adapter
(28)
this model