Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Deepseek ai Janus Conversation Formatting

From Leeroopedia


Knowledge Sources
Domains NLP, Prompt_Engineering
Last Updated 2026-02-10 09:30 GMT

Overview

A template-based system for formatting multi-turn conversations into structured prompts that language models can process.

Description

Conversation formatting converts a list of message dictionaries (with roles like "User" and "Assistant") into a single string prompt that follows a specific template format. This is critical for instruction-tuned models that expect inputs in a particular supervised fine-tuning (SFT) format.

The Janus repository uses a conversation template system adapted from FastChat. Each template defines role names, separator tokens, and formatting rules. The primary template used is "deepseek", which uses <|User|> and <|Assistant|> role markers with <|end▁of▁sentence|> as the end-of-turn separator.

Usage

Use this principle whenever preparing text input for Janus models, whether for multimodal understanding or image generation. The conversation must be formatted into the correct SFT template before tokenization.

Theoretical Basis

The conversation template follows a structured format:

# Abstract template structure (DeepSeek style)
# {system_message}\n\n
# <|User|>: {user_message}\n\n
# <|Assistant|>: {assistant_message}<|end▁of▁sentence|>
# <|User|>: {next_message}\n\n
# <|Assistant|>:

Key design decisions:

  • Role markers (<|User|>, <|Assistant|>) delimit turn boundaries
  • Separator tokens (\n\n between roles, <|end▁of▁sentence|> after assistant) signal turn completion
  • Empty assistant content signals the model should generate a response
  • The template is registered globally and retrieved by name via get_conv_template

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment