← 开源

NCM: Next Concept Modeling

ModelsFoundation modelsPython
增长势头
+424 小时新增 Star+0.2%
2.13k
Star
304
Fork
+35
本周
7
贡献者
创建于 2026-10-11 · 更新于 2026-12-06 · 今日第 2590 名
主要开发者
Kumbongbenjamin-asdfvelaia
README

Next-Concept Modeling

Fast, Parallel Coarse-to-Fine Text Generation

Next-Concept Modeling (NCM) is a two-stage framework for parallel text generation. A multiscale residual VQ tokenizer represents a sequence as a hierarchy of discrete codes, and a transformer predicts that hierarchy from coarse to fine. Positions within a level are generated in parallel, so generation requires one forward evaluation per level.

Highlights

Coarse-to-fine generation

NCM generates coarse to fine: each level predicts a longer sequence in parallel, and decoding every level shows a sample being refined from a rough sketch to the full output in a few steps.

Quality at a fraction of the cost

NCM beats or matches strong diffusion baselines on different tasks & datasets while generating 9-31× faster.

Released models

Weights and tokenized datasets are hosted in the NCM Hugging Face collection. Each released model consists of a frozen tokenizer and a next-concept generator.

TaskModelTokenizerGeneratorConfigData
XSum–tokenizer.ptgenerator.ptconfig.yamltest set
WMT14 De–En–tokenizer.ptgenerator.ptconfig.yamltest set
SudokuEasytokenizer.ptgenerator.ptconfig.yamltest boards
Mediumtokenizer.ptgenerator.ptconfig.yaml
Hardtokenizer.ptgenerator.ptconfig.yaml
LM1BSmalltokenizer.ptgenerator.ptconfig.yamltokenized text
Mediumgenerator.ptconfig.yaml
Largegenerator.ptconfig.yaml
TinyStories–tokenizer.ptgenerator.ptconfig.yamltokenized text
OpenWebText–tokenizer.ptgenerator.ptconfig.yamltokenized text

Installation

git clone https://github.com/HazyResearch/ncm.git
cd ncm
pip install -r requirements.txt

Python 3.10 or newer and a CUDA-capable PyTorch installation are recommended.

Generation

Download just the TinyStories checkpoints and generate a sample in the terminal:

hf download hazyresearch/ncm-checkpoints --include "tinystories/*" --local-dir artifacts
python generate.py --config configs/generation/tinystories.yaml

For other tasks, choose a config from configs/generation/ and download the matching checkpoints and conditional inputs as described under Evaluation:

python generate.py --config configs/generation/<task>.yaml
python generate.py --config configs/generation/sudoku-hard.yaml --trajectory

Conditional examples show the prompt, generated answer and reference; Sudoku is rendered as a board. --trajectory shows each hierarchy prefix and is off by default. Override --seed or --samples, and add --out samples.jsonl to save the outputs. The default seeds select illustrative examples. LM1B displays the full packed sequence, including text after sentence separators.

Inference uses BF16 by default; add --precision fp32 to use FP32.

Evaluation

Download all released checkpoints and evaluation inputs:

hf download hazyresearch/ncm-checkpoints --local-dir artifacts
hf download hazyresearch/ncm-datasets --repo-type dataset --local-dir data

Then run:

# XSum or WMT14: <task> is xsum or wmt14
python evaluate.py --config config/eval/<task>.yaml --checkpoint-dir artifacts/<task> --data-dir data/<task>

# Sudoku: <difficulty> is easy, medium or hard
python evaluate.py --config config/eval/sudoku-<difficulty>.yaml --checkpoint-dir artifacts/sudoku/<difficulty> --data-dir data/sudoku/<difficulty>

# Unconditional text: <dataset> is tinystories or owt
python evaluate.py --config config/eval/<dataset>.yaml --checkpoint-dir artifacts/<dataset>

# LM1B: <size> is small, medium or large
python evaluate.py --config config/eval/lm1b-<size>.yaml --checkpoint-dir artifacts/lm1b/<size>

Evaluation runs one shard per visible GPU, merges the predictions, and prints task-specific scores. Add --gpus 0 to use one GPU, or --cfg <scale> for classifier-free guidance on XSum and WMT14.

XSum, WMT14 and Sudoku enable soft decisions by default. Set generation.soft_decisions: false to disable them, or adjust generation.soft_temperature. CLI overrides are --no-soft-decisions and --soft-temperature <value>; soft temperature is separate from sampling temperature.

Results below use BF16, no guidance, and one H100 80GB. XSum/WMT14 use --bs 16; other tasks use their config's batch size. Every conditional test example is included and scored against its complete reference, with no filtering by answer length.

TaskModelResults
XSum–ROUGE-1 ↑ROUGE-2 ↑ROUGE-L ↑
36.1613.8829.57
WMT14 De–En–BLEU, cased ↑BLEU, lowercase ↑–
25.2726.20–
Sudoku–Solved (%) ↑––
Easy99.55––
Medium97.75––
Hard90.05––
LM1B–Gen. PPL ↓Entropy ↑–
Small94.764.3158–
Medium91.304.3469–
Large83.274.3475–
TinyStories15k EMAGen. PPL ↓Entropy ↑–
15.543.9733–

Benchmarking

python benchmark.py --config config/benchmark/<task>.yaml

Use the same task names as in config/eval/. Defaults are 1,024 samples, batch size 16, BF16, and three timed repetitions after warmup. Timing includes input preparation through decoded text; model loading, compilation and warmup are excluded. Add --precision fp32 to use FP32, or set benchmark.samples: null to time a full conditional test split. Results and settings are saved under outputs/benchmark/.

Measured on one NVIDIA H100 80GB with BF16, PyTorch 2.11, CUDA 12.8, and the default inference optimizations. Results are median total wall-clock times after 25 warmup requests; B is batch size and N is the total number of generated samples.

TaskModelOutput
tokens
LevelsB=1, N=1
(ms)
B=16, N=16
(ms)
B=32, N=32
(ms)
B=16, N=1024
(s)
XSum–48912.0724.4037.251.550
WMT14 De–En–641113.0021.2729.611.310
SudokuEasy89127.319.2411.970.574
Medium7.299.1012.000.575
Hard7.259.2712.030.575
LM1BSmall1281214.3524.4434.411.537
Medium28.1646.9270.922.836
Large47.3385.17128.635.342
TinyStories–1281213.1720.2128.151.246

Output tokens is the fixed generated length before EOS trimming; Sudoku uses 81 cells plus eight row separators. Levels is the number of levels in the code hierarchy.

Reproduce each column with the command above, adding --batch-size B --samples N --repeats R: use R=30 for the first three columns and R=3 for the last.

Repository layout

  • generate.py, configs/generation/: terminal examples and optional generation trajectories
  • evaluate.py: evaluation entry point
  • benchmark.py, config/benchmark/: generation speed benchmarks
  • scripts/: per-GPU generation shard and the merge that scores it
  • config/eval/: one config per released checkpoint, identical to the config.yaml shipped with it
  • models/, tokenization/: generator and tokenizer implementations

Citation

@misc{kumbong2026nextconcept,
      title={Next-Concept Modeling: Fast, Parallel Coarse-to-Fine Text Generation},
      author={Hermann Kumbong and Ishan S. Khare and Iddah Mlauzi and Andrew Woen and Charles Ding and E. Kelly Buchanan and Simran Arora and Azalia Mirhoseini and Christopher Ré},
      year={2026},
      eprint={2610.14162},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2610.14162},
}

@inproceedings{kumbong2025hmar,
  title={Hmar: Efficient hierarchical masked auto-regressive image generation},
  author={Kumbong, Hermann and Liu, Xian and Lin, Tsung-Yi and Liu, Ming-Yu and Liu, Xihui and Liu, Ziwei and Fu, Daniel Y and Re, Christopher and Romero, David W},
  booktitle={2025 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
  pages={2535--2544},
  year={2025},
  organization={IEEE}
}

Released under the MIT license.

排名相邻
同类项目

AI Rank iPhone 版

随时追踪 AI 模型榜单

在 App Store 下载