inclusionAI/LLaDA2.0-Uni
LLaDA2.0-Uni: Understanding and Generation the World.
LLaDA2.0‑Uni – 멀티모달 이해 및 생성을 위한 통합 확산 LLM
개요 – LLaDA2.0‑Uni는 확산 기반 대규모 언어 모델(dLLM)과 Mixture‑of‑Experts 백본을 결합한 대규모 멀티모달 모델입니다. 단일 마스크 토큰 예측 인터페이스를 통해 텍스트, 이미지 및 이미지 편집 지시를 처리합니다. 이 모델은 시각적 데이터를 이산적인 의미 토큰으로 변환하고(SigLIP‑VQ 토크나이저 사용), 빠른 확산 디코더(8단계 증류 추론)로 해당 토큰을 디코딩합니다.
주요 기능
- 텍스트-이미지 생성 – 고품질 1024×1024 이미지, 모델의 내부 추론 단계를 보여주는 선택적 "사고" 모드.
- 이미지 이해 – 동일한 토큰 기반 인터페이스를 사용하는 시각적 질의응답 및 문서 이해.
- 지시 가이드 이미지 편집 – 요청된 변경 사항을 적용하면서 세부 정보를 유지하는 단일 또는 다중 참조 편집.
- 인터리브 생성 및 추론 – 통합된 토큰 표현을 통해 모델이 동일한 프롬프트 내에서 이미지 생성과 추론을 전환할 수 있음.
- SPRINT 가속 – 추론 시간을 단축하는 캐시 재사용 및 적응형 언마스킹 방식(decoder‑turbo를 통해 디코딩 속도 최대 약 10배 향상).
- 통합 훅 – ComfyUI, Diffusers, 고처리량 서빙을 위한 SGLang‑Omni용 즉시 사용 가능한 노드.
모델 아키텍처
- LLaDA 2.0 기반의 통합 dLLM‑MoE 백본.
- 이미지를 토큰 시퀀스로 변환하는 이산 의미 토크나이저 (SigLIP‑VQ).
- 효율적인 확산 디코더 (표준 50단계 ODE 또는 증류된 8단계 "turbo").
시작하기
# Clone & create environment
git clone https://github.com/inclusionAI/LLaDA2-Uni && cd LLaDA2-Uni
conda create -n llada2_uni python=3.10 -y && conda activate llada2_uni
# Install PyTorch (CUDA 12.4) and FlashAttention 2
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu124
pip install flash-attn --no-build-isolation
# Install the rest of the dependencies
pip install -r requirements.txt
Python 퀵스타트 – 이미지 생성
from transformers import AutoModelForCausalLM, AutoTokenizer
from decoder import decode_vq_tokens
model_path = "inclusionAI/LLaDA2.0-Uni"
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_path, device_map="cuda", torch_dtype="bfloat16", trust_remote_code=True
).eval()
model.tokenizer = tokenizer
result = model.generate_image(
"A modern Scandinavian kitchen with white cabinetry, marble countertops, and a single orchid on the island.",
image_h=1024, image_w=1024, steps=8, cfg_scale=2.0,
)
# Decode (8‑step turbo decoder for speed)
image = decode_vq_tokens(
result["token_ids"], result["h"], result["w"], model_path, "cuda",
num_steps=8, decode_mode="decoder-turbo",
)
image.save("kitchen.png")
이미지 이해 예제
from encoder.image_tokenizer import ImageTokenizer
from decoder.smart_img_process import smart_resize_images
image_tokenizer = ImageTokenizer(model_path=model_path, device="cuda")
pil = smart_resize_images(["./assets/understanding_example.png"])[0]
info = image_tokenizer.encode_with_info(pil)
image_tokens = [t + model.config.image_token_offset for t in info["token_ids"]]
_, h, w = info["grid_thw"]
response = model.understand_image(
image_tokens, h, w,
question="Describe this image in detail.",
steps=32, gen_length=2048,
)
print(response)
이미지 편집 예제
# Same tokenisation as above, then:
result = model.edit_image(
image_tokens, h, w,
instruction="Change the background to a beach.",
steps=8, cfg_text_scale=4.0,
)
edited = decode_vq_tokens(
result["token_ids"], result["h"], result["w"], model_path, "cuda",
num_steps=8, decode_mode="decoder-turbo",
)
edited.save("beach.png")
ComfyUI 통합 – 저장소를 복제한 후 apps/comfyui 폴더를 ComfyUI custom_nodes 디렉토리에 연결합니다(또는 제공된 install.sh 실행). 이 패키지는 모델 로드, 텍스트-이미지 생성, 이미지 이해, 이미지 편집 및 토큰 디코딩을 위한 노드를 추가합니다.
SGLang 서빙 – 링크된 SGLang‑Omni 쿡북을 참조하여 동일한 저지연 추론 경로로 많은 동시 요청을 처리할 수 있는 즉시 실행 가능한 서버를 확인하세요.
모델 체크포인트 – HuggingFace 및 ModelScope에서 전체 정밀도 및 FP8 양자화 버전으로 제공됩니다.
라이선스 – Apache 2.0.
인용
@article{LLaDA2Uni,
title = {LLaDA2.0‑Uni: Unifying Multimodal Understanding and Generation with Diffusion Large Language Model},
author = {Tiwei Bie and Haoxing Chen and Tieyuan Chen and Zhenglin Cheng and Long Cui and Kai Gan and Zhicheng Huang and Zhenzhong Lan and Haoquan Li and Jianguo Li and Tao Lin and Qi Qin and Hongjun Wang and Xiaomei Wang and Haoyuan Wu and Yi Xin and Junbo Zhao},
journal = {arXiv preprint arXiv:2604.20796},
year = {2026}
}
LLaDA2.0‑Uni는 멀티모달 인식과 확산 기반 생성을 단일 토큰 예측 모델로 통합하여, 고품질 이미지 합성, 시각적 추론 또는 지시 기반 편집이 필요한 개발자에게 빠르고 캐시 가속화된 추론 기능을 갖춘 다목적 툴박스를 제공합니다.
관련
- 프로젝트
- 프로젝트
- 프로젝트
- 프로젝트