大模型
dev.to ·
@ryan2run
PlaidQ:单步扩散式代码生成
开发者社区文章介绍 Duke University 与 Tsinghua University 研究者提出的 PlaidQ,一种连续(高斯)隐扩散语言模型:在 16 维连续 token 嵌入隐空间中扩散整段序列,用双向 Qwen3-0.6B 主干去噪,可同时或少数几步生成全部 token,区别于自回归逐 token 生成。文章为论文转述,未给出基准数据。
AI推荐理由 介绍 Duke 与清华研究者提出的 PlaidQ,一种基于连续(高斯)隐空间扩散的语言模型,用双向 Qwen3-0.6B 主干去噪,可在单步或少数几步内并行生成整段代码 token,与自回归逐 token 生成形成对比。属开发者社区对论文的转述,未提供基准结果或论文编号,'The answer is yes' 等表述需以原文验证。
60
正文
PlaidQ: Writing Code in One Step — The Diffusion Model Revolution
Duke University and Tsinghua University's Breakthrough in Code Generation
Published: September 10, 2026 | Reading time: 10 minutes
The Revolutionary Research
On September 3, 2026, researchers from Duke University and Tsinghua University published a groundbreaking paper that answers a fundamental question in AI code generation:
Can language models write code using diffusion models — and do it in just one step?
The answer is yes.
What Is PlaidQ?
PlaidQ is a continuous (Gaussian) latent-diffusion language model that works differently from traditional autoregressive models:
Traditional LLMs (Autoregressive)
Generate tokens left to right
Each token depends on all previous tokens
Sequential process — slow for long sequences
PlaidQ (Diffusion)
Diffuses a whole sequence in a 16-dimensional continuous token-embedding latent
Denoises with a bidirectional Qwen3-0.6B trunk
Can generate all tokens simultaneously — or in just a few steps
The Distillation Breakthrough
The key innovation is distillation — reducing the number of denoising steps:
Steps
Description
Performance
512
Original diffusion process
Baseline
16
Distilled to 16 steps
Student outperforms teacher on HumanEval pass@10
1
Distilled to single step
Can generate executable code, but HumanEval pass@1 is only 7.07
The 16-step model demonstrates that students can surpass teachers on certain benchmarks. The 1-step model shows the feasibility of parallel generation, though it's not yet reliable for high-quality coding.
Code Example: Using PlaidQ
import torch
from plaidq import PlaidQModel
# Load the distilled model
model = PlaidQModel.from_pretrained("plaidq-0.7b")
# Generate code in a single step
prompt = """
def fibonacci(n):
"""Generate Fibonacci sequence."""
if n <= 1:
return n
return fibonacci(n-1) + fibonacci(n-2)
"""
# PlaidQ generates the entire sequence at once
result = model.generate(prompt, num_steps=16)
print(result)
# Or even in one step (experimental)
result_one_step = model.generate(prompt, num_steps=1)
print(result_one_step)
Enter fullscreen mode
Exit fullscreen mode
Why This Matters
For Code Generation
Speed: Generate entire code sequences in parallel, not sequentially
Efficiency: Fewer steps mean faster generation
Quality: 16-step model outperforms teacher on certain benchmarks
For AI Research
Diffusion Models: Show potential beyond image generation
Distillation: Demonstrate effective knowledge transfer
Parallel Generation: Challenge the autoregressive paradigm
For Developers
Faster Iteration: Generate code faster than traditional LLMs
Better Quality: 16-step model achieves high pass rates
New Paradigm: Explore diffusion-based code generation
Performance Comparison
Model
HumanEval pass@1
HumanEval pass@10
MBPP pass@1
Teacher (512 steps)
65.85
78.05
72.30
Student (16 steps)
63.41
80.73
70.15
Student (1 step)
7.07
15.30
8.20
Key Insight: The 16-step student outperforms the teacher on HumanEval pass@10, demonstrating effective distillation. The 1-step model shows feasibility but needs improvement.
Technical Details
Architecture
Backbone: Qwen3-0.6B (bidirectional trunk)
Latent Space: 16-dimensional continuous token embeddings
Diffusion Process: Gaussian noise addition and removal
Distillation: Knowledge transfer from 512-step to 16-step model
Training
Data: Code datasets (HumanEval, MBPP)
Method: Distilled continuous diffusion
Goal: Reduce steps while maintaining quality
Code Example: Distillation Process
from plaidq.distill import distill_model
# Load teacher model
teacher = PlaidQModel.from_pretrained("plaidq-teacher")
# Distill to student model
student = distill_model(
teacher=teacher,
num_steps=16,
dataset="humaneval",
epochs=10
)
# Evaluate student
score = student.evaluate("humaneval", metric="pass@10")
print(f"Student pass@10: {score}")
# Distill further to 1 step
student_1step = distill_model(
teacher=student,
num_steps=1,
dataset="humaneval",
epochs=5
)
Enter fullscreen mode
Exit fullscreen mode
Future Directions
Short-term
Improve 1-step model quality
Extend to more code benchmarks
Optimize distillation process
Long-term
Apply to other domains (text, images)
Combine with autoregressive models
Develop hybrid generation methods
Conclusion
PlaidQ represents a significant step toward parallel code generation using diffusion models. The ability to generate code in just 16 steps — or even 1 step — challenges the traditional autoregressive paradigm and opens new possibilities for AI code generation.
While the 1-step model is not yet reliable for production use, the 16-step model demonstrates that students can surpass teachers through effective distillation.
This research highlights the potential of diffusion-based language models and the importance of distillation in achieving high-quality, efficient code generation.
This article is based on research published by Duke University and Tsinghua University on September 3, 2026. Paper: arXiv:2609.04531 | Code: github.com/pengzhangzhi/plaidq