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:Mit han lab Llm awq Conversation Template Management

From Leeroopedia
Knowledge Sources
Domains NLP, Prompt_Engineering
Last Updated 2026-02-15 00:00 GMT

Overview

Principle of managing conversation prompt templates that format user/assistant message histories into model-specific prompt strings.

Description

Different LLMs expect different prompt formats (ChatML, LLAMA2, Vicuna, MPT, etc.). Conversation template management provides a registry pattern where named templates define the system prompt, role labels, separator tokens, and stop criteria. A conversation object accumulates messages and produces a formatted prompt string via get_prompt(). This abstraction decouples the application logic from model-specific formatting requirements.

Usage

Apply this principle whenever an application needs to support multiple chat model backends with different prompt formats. The template pattern ensures correct formatting without hardcoding model-specific logic.

Theoretical Basis

The core pattern is a Strategy design: each separator style defines a different formatting algorithm, selected at runtime based on the model. The Registry pattern (global dict of templates) enables extensibility.

Related Pages

Page Connections

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