Principle:Deepseek ai Janus Prompt Formatting for Generation
| Knowledge Sources | |
|---|---|
| Domains | NLP, Image_Generation |
| Last Updated | 2026-02-10 09:30 GMT |
Overview
A procedure for formatting a text prompt into the SFT template format and appending the image generation start token to trigger autoregressive image token generation.
Description
Prompt formatting for image generation follows the same SFT template system as multimodal understanding, but with a critical addition: after the formatted prompt, the <begin_of_image> token is appended to signal the model to switch from text mode to image generation mode.
The conversation structure for generation is simpler than understanding — it contains only the text prompt without any image placeholders. The User message contains the generation prompt, and the Assistant message is empty (triggering generation).
Usage
Use this principle at the start of the autoregressive image generation pipeline. The formatted prompt with the appended image start token is then tokenized and used to construct the CFG input pairs.
Theoretical Basis
The prompt is constructed in two stages:
- SFT template application: The conversation messages are formatted using the DeepSeek template, producing a string like "<|User|>: {prompt}\n\n<|Assistant|>:"
- Generation trigger: The image_start_tag ("<begin_of_image>") is appended, signaling the model's generation head to start producing VQ codebook indices
This trigger token is what differentiates a text generation request from an image generation request in the unified Janus architecture.