tahamajs/BlockDiffuse
๐ BlockDiffuse: Fully Parallel Latent Space Reasoning Generation
   
TL;DR: BlockDiffuse is a non-autoregressive / block-autoregressive generative framework that generates 100 tokens simultaneously in continuous latent space using Rectified Flow Matching and a Diffusion Transformer (DiT) conditioned on intermediate layers of modern LLMs (Qwen/Qwen2.5-0.5B-Instruct).โก Key Highlights & Benchmark Results
All benchmarks measured on a single consumer NVIDIA GeForce RTX 4070 Laptop GPU (8GB VRAM):
๐๏ธ Architecture Overview
Prompt Prefix โโโบ Frozen Qwen2.5 (Layers 1..12) โโโบ Continuous Context c [L_p x 896]
โ
Initial Gaussian Noise z_0 [100 x 896] ~ N(0, I) โโโโโโโโโโค
โผ
BlockDiffuse DiT (8 Layers, 14 Heads)
- AdaLN-Zero Timestep Conditioning
- Continuous RoPE Positional Encoding
- Rectified Flow (v-prediction)
โ
โผ
Predicted Latents z_1 [100 x 896]
โ
โผ
Deep Proj Head (3-Layer SwiGLU MLP)
โ
โผ
Pre-Head RMSNorm + Frozen LM Head
โ
โผ
Discrete Next 100 Tokens in Parallel1. Base LLM Backbone
- Model:
Qwen/Qwen2.5-0.5B-Instruct - Representation Layer: Layer 12 (mid-layer context extraction, $d_{\text{model}} = 896$).
- Head: Frozen LM head with vocab size $151{,}936$.
2. Diffusion Transformer (DiT)
- Depth: 8 Transformer Blocks.
- Attention: 14 heads (head dimension 64, matches $d_{\text{model}} = 896$).
- Initialization: Direct parameter transfer from layers 6โ11 of Qwen2.5-0.5B.
- Modulation: AdaLN-Zero modulates scale and shift parameters based on timestep $t \in [0, 1]$.
3. Flow Matching & Multi-Objective Training
Rectified Flow straight-line trajectory: $$zt = (1 - t) z0 + t z1, \quad vt = \frac{dzt}{dt} = z1 - z_0$$
Trained under composite multi-loss: $$\mathcal{L}{\text{total}} = \lambda{\text{FM}} \mathcal{L}{\text{FM}} + \lambda{\text{disp}} \mathcal{L}{\text{disp}} + \lambda{\text{KL}} \mathcal{L}{\text{KL}} + \lambda{\text{CE}} \mathcal{L}{\text{CE}} + \lambda{\text{NN}} \mathcal{L}_{\text{NN}}$$
๐ป Quickstart: Inference
1. Clone & Setup
git clone https://github.com/Hooshaai/BlockDiffuse.git
cd BlockDiffuse
pip install -r requirements.txt2. Download Checkpoint from Hugging Face
from huggingface_hub import hf_hub_download
ckpt_path = hf_hub_download(
repo_id="tahamajs/BlockDiffuse",
filename="blockdiffuse_final.pt"
)
print("Checkpoint downloaded to:", ckpt_path)3. Run Parallel Multi-Block Generation
python inference.py \
--model Qwen/Qwen2.5-0.5B-Instruct \
--checkpoint ./checkpoints_improved/blockdiffuse_final.pt \
--prompt "<|im_start|>system\nYou are a helpful assistant that solves problems step by step.<|im_end|>\n<|im_start|>user\nA bookstore has 140 books on Monday. On Tuesday, they sell 45 books. On Wednesday, they receive 80 books. How many remain?<|im_end|>\n<|im_start|>assistant\n" \
--max_blocks 2 \
--steps 8 \
--solver dpm_solver \
--use_tfe \
--tfe_seeds 3๐ Citation
@article{blockdiffuse2026,
title={BlockDiffuse: Fully Parallel Latent Space Reasoning Generation with Diffusion Transformers},
author={Hooshaai Research},
journal={GitHub / HuggingFace Technical Report},
year={2026},
url={https://github.com/Hooshaai/BlockDiffuse}
}