Diffusion-LFM3-1.7B

An experimental block-diffusion language model fine-tuned from LiquidAI/LFM3-1.7B-Base (by Liquid AI).

Text is generated block by block (block length 32): blocks are produced autoregressively, and tokens inside each block are produced by iterative masked-diffusion denoising with confidence-threshold parallel decoding.

โš ๏ธ This is a research preview trained for only 377 optimizer steps. Outputs may contain repeated words, truncated words, and factual errors. Not suitable for production use.

Modifications from the base model

This repository contains a modified version of LiquidAI/LFM3-1.7B-Base:

  • Added the special token <|mdm_mask|> and resized the tied embeddings.
  • Fine-tuned all weights with a block-diffusion objective (clean context blocks + one noised block, 1/t-weighted cross-entropy, complementary masking, Dream-style logit shift).
  • At load time, blockdiff_inference.py patches the attention mask to block-causal (bidirectional within a block, causal across blocks; sliding-window layers keep a symmetric window) and replaces the causal short convolutions with centered ones. The original modeling code files are included unmodified.

Loading this model with plain generate() will not work correctly; use the script below.

Usage

# pip install -U "transformers>=5.12" huggingface_hub
from huggingface_hub import hf_hub_download
import importlib.util, sys
path = hf_hub_download("summerAIO/Diffusion-LFM3-1.7B", "blockdiff_inference.py")
spec = importlib.util.spec_from_file_location("blockdiff_inference", path)
bd = importlib.util.module_from_spec(spec); spec.loader.exec_module(bd)

model, tok, mask_id = bd.load("summerAIO/Diffusion-LFM3-1.7B")
print(bd.generate(model, tok, mask_id, "The capital of France is", gen_len=128, tau=0.9))

tau controls parallelism: lower = more tokens per forward pass (faster), higher = better quality.

Training

  • Base: LiquidAI/LFM3-1.7B-Base
  • Data: HuggingFaceFW/fineweb-edu (sample-10BT)
  • Block length 32, context up to 15 blocks, lr 2e-05, AdamW, bf16
  • 377 optimizer steps

License

This model is a derivative of LiquidAI/LFM3-1.7B-Base and is distributed under the LFM Open License v1.0 โ€” see LICENSE and NOTICE.

  • Commercial use is permitted only for individuals/legal entities with annual revenue under US$10 million (see Section 5 of the license). Qualified non-profits may use it for non-commercial or research purposes regardless of that threshold.
  • Any redistribution must include the license, retain attribution notices, and state modifications.
  • This project is not affiliated with or endorsed by Liquid AI. "LFM" and "Liquid AI" are used only to identify the origin of the base model.

Attribution

Base model: LiquidAI/LFM3-1.7B-Base ยฉ Liquid AI.

Downloads last month
-
Safetensors
Model size
2B params
Tensor type
BF16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for summerAIO/Diffusion-LFM3-1.7B-pre

Finetuned
(22)
this model