File size: 5,566 Bytes
9f24b76
 
 
 
 
 
 
 
 
4b35acc
 
9f24b76
 
 
 
 
 
 
 
 
 
 
 
4b35acc
 
9f24b76
4b35acc
9f24b76
 
 
4b35acc
 
 
 
 
 
 
9f24b76
4b35acc
 
 
 
 
9f24b76
 
4b35acc
 
9f24b76
 
4b35acc
9f24b76
 
 
4b35acc
9f24b76
4b35acc
 
 
 
 
 
9f24b76
 
 
4b35acc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9f24b76
 
 
 
4b35acc
 
 
 
9f24b76
4b35acc
 
 
 
 
9f24b76
 
4b35acc
 
 
 
 
 
9f24b76
4b35acc
9f24b76
 
 
4b35acc
9f24b76
 
 
 
 
 
 
 
 
 
4b35acc
9f24b76
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
---
license: apache-2.0
tags:
- flow-matching
- continuous-latents
- math-reasoning
- qwen2.5
- block-diffusion
- non-autoregressive
- gsm8k
- chain-of-thought
size_categories:
- 10K<n<100K
task_categories:
- text-generation
language:
- en
---

# 📦 BlockDiffuse Precomputed Latents & Reasoning Datasets

[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Base Model](https://img.shields.io/badge/Base%20LLM-Qwen2.5--0.5B--Instruct-green.svg)](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct)
[![HuggingFace Model](https://img.shields.io/badge/HF%20Model-Hooshaai%2FBlockDiffuse-yellow.svg)](https://huggingface.co/Hooshaai/BlockDiffuse)
[![HuggingFace Space](https://img.shields.io/badge/HF%20Space-BlockDiffuse--Blog-blueviolet.svg)](https://huggingface.co/spaces/Hooshaai/BlockDiffuse-Blog)

This repository hosts the complete suite of pre-tokenized reasoning datasets and continuous latent trajectory representations extracted from **`Qwen/Qwen2.5-0.5B-Instruct`** for training **BlockDiffuse** Diffusion Transformers via **Rectified Flow Matching**.

---

## 📑 Table of Contents
1. [Dataset Pipeline & Extraction Architecture](#1-dataset-pipeline--extraction-architecture)
2. [Dataset Files Manifest & Specifications](#2-dataset-files-manifest--specifications)
3. [Data Formats & Internal Tensor Keys](#3-data-formats--internal-tensor-keys)
4. [How to Load and Inspect with PyTorch](#4-how-to-load-and-inspect-with-pytorch)
5. [End-to-End Training Instructions](#5-end-to-end-training-instructions)
6. [Citation](#6-citation)

---

## 1. Dataset Pipeline & Extraction Architecture

Modern LLMs operate over discrete token vocabularies ($V = 151{,}936$). To train a Diffusion Transformer to denoise entire sequences simultaneously, BlockDiffuse maps prompts and target answers into continuous representation vectors:

```
Discrete Prompt Tokens (L_p) ──► Qwen2.5 (Layers 1..12) ──► Prompt Latents c [L_p x 896]
Discrete Target Tokens (100) ──► Qwen2.5 (Layers 1..12) ──► Target Latents z_1 [100 x 896]
```

By precomputing and persisting these continuous tensors to disk, BlockDiffuse eliminates redundant forward passes through the LLM during training, boosting training throughput by **> 12x** on single-GPU hardware.

---

## 2. Dataset Files Manifest & Specifications

| File Name | File Size | Description | Target Tasks | Samples Count |
| :--- | :--- | :--- | :--- | :--- |
| `reasoning_tokenized_qwen.pt` | **13.1 MB** | Pre-tokenized GSM8K & Math reasoning traces formatted using the Qwen2.5 ChatML format (`<\|im_start\|>system...user...assistant<\|im_end\|>`). | Token-level evaluation & tokenized baseline training | ~10,000 samples |
| `precomputed_reasoning_latents_qwen.pt` | **72.4 MB** | Validation subset of continuous target latents ($z_1 \in \mathbb{R}^{B \times 100 \times 896}$) and prompt conditionings ($c \in \mathbb{R}^{B \times L_p \times 896}$). | Rapid model validation & loss metric evaluation | 1,000 trajectories |
| `precomputed_real_qwen.pt` | **1,045.9 MB** | Intermediate-scale latent training dataset containing multi-turn mathematical reasoning trajectories. | Medium-scale training (1,000–5,000 steps) | 1,000 long traces |
| `precomputed_real_qwen_full.pt` | **2,360.3 MB** | Complete production-scale training set covering multi-step mathematical and algorithmic reasoning problems. | Full-scale training (20,000 steps) | Full GSM8K + Math traces |

---

## 3. Data Formats & Internal Tensor Keys

Each `.pt` file is a serialized Python dictionary with the following tensor schema:

```python
{
    "prompt_latents": torch.Tensor,   # Shape: [N, max_prompt_len, 896] (float32 / bfloat16)
    "target_latents": torch.Tensor,   # Shape: [N, 100, 896] (Target latents z_1 at Layer 12)
    "target_tokens": torch.Tensor,    # Shape: [N, 100] (Ground truth discrete token IDs for CE loss)
    "prompt_lens": torch.Tensor,      # Shape: [N] (Exact token length of each prompt prefix)
}
```

---

## 4. How to Load and Inspect with PyTorch

```python
import torch

# 1. Inspect Tokenized Sequences
tokenized = torch.load("reasoning_tokenized_qwen.pt", map_location="cpu")
print("Total tokenized entries:", len(tokenized["input_ids"]))
print("Sample input_ids shape:", tokenized["input_ids"][0].shape)

# 2. Inspect Continuous Latents
latents = torch.load("precomputed_reasoning_latents_qwen.pt", map_location="cpu")
print("Prompt latents shape:", latents["prompt_latents"].shape)  # [N, L_p, 896]
print("Target latents shape:", latents["target_latents"].shape)  # [N, 100, 896]
print("Target tokens shape:", latents["target_tokens"].shape)    # [N, 100]
```

---

## 5. End-to-End Training Instructions

To train a BlockDiffuse DiT model from scratch using these precomputed latents:

```bash
# 1. Clone official repository
git clone https://github.com/Hooshaai/BlockDiffuse.git
cd BlockDiffuse

# 2. Train with the full precomputed dataset
python train.py \
    --config_train configs/gpu_full_capacity_improved.yaml \
    --config_dit configs/gpu_full_capacity_improved.yaml \
    --data_path ./data/precomputed_real_qwen_full.pt \
    --max_steps 20000 \
    --output_dir ./checkpoints_improved
```

---

## 6. Citation

```bibtex
@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}
}
```