# Szablony czatu i formaty rozmów

EN: **Chat templates and conversation formats** · id `chattemplates`

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Trenowanie i dostrajanie](https://aiatlasgraph.com/t/training.md) › [Post-training](https://aiatlasgraph.com/t/posttraining.md) › Szablony czatu i formaty rozmów

## Description

- PL: Jak rozmowa jest zapisana w zbiorze i zamieniona na tekst dla modelu. Szablon z treningu musi się zgadzać przy uruchomieniu.
- EN: How a conversation is stored in a dataset and turned into text for the model. The training template has to match at inference.

## In one sentence

- PL: To ustalony sposób zapisywania rozmowy, żeby model rozpoznawał role, wiadomości i początek swojej odpowiedzi.
- EN: This formats conversations so a model recognises roles, messages and where its response starts.

## Problem it solves

- PL: Model odpowiada dziwnie, gdy wiadomości są zapisane inaczej niż rozmowy używane podczas jego uczenia.
- EN: A model responds oddly when messages are formatted differently from the conversations used in training.

## What it does

- PL: Szablon dodaje właściwe znaczniki i kolejność wiadomości; aplikacja powinna stosować format zgodny z treningiem danego modelu.
- EN: A template adds appropriate markers and message order; an application should use the format matching that model's training.

## Everyday example

- PL: Po zmianie modelu sprawdzasz szablon rozmowy, żeby nie traktował treści użytkownika jak własnej wcześniejszej odpowiedzi.
- EN: After changing models, you check the conversation template so user content is not interpreted as the model's earlier reply.

## This concerns you if you…

- PL: uruchamiasz model rozmów
- PL: zmieniasz model i format przekazywanych wiadomości
- EN: run a conversational model
- EN: change models and message formats

## Keywords

ChatML · ShareGPT · Alpaca format · Jinja templates · role tokens · generation prompt · turn-end tokens

## How it works

- PL: Szablon zamienia role, treści i granice wiadomości na sekwencję tokenów właściwą dla modelu. Znaczniki rozpoczęcia odpowiedzi i zakończenia tury łączą format danych treningowych z wejściem używanym podczas generowania.
- EN: A template converts roles, content and message boundaries into a model-specific token sequence. Response-start and turn-end markers connect training-data formats with inputs used during generation.

## Limits

- PL: Niezgodny szablon zmienia znaczenie ról lub wywołuje nieoczekiwane kontynuacje. Podwójne znaczniki specjalne i błędne maskowanie zaburzają trening; format narzędzi zależy od konkretnej receptury modelu.
- EN: Mismatched templates alter role meanings or trigger unexpected continuations. Duplicate special markers and incorrect masking disrupt training; tool formats depend on the model's specific recipe.

## Key terms

- PL: **token specjalny**: Symbol wyznaczający strukturę lub sterowanie zamiast zwykłej treści.
- PL: **prefiks odpowiedzi**: Końcowy fragment wejścia wskazujący, gdzie model zaczyna własną wiadomość.
- EN: **special token**: A symbol marking structure or control rather than ordinary content.
- EN: **response prefix**: The final input segment indicating where the model starts its message.

## Know first

- [Tokenizacja tekstu (BPE, WordPiece, SentencePiece) (Text tokenisation (BPE, WordPiece, SentencePiece))](https://aiatlasgraph.com/t/tokenization.md)
- [Structured outputs i walidacja (Structured outputs and validation)](https://aiatlasgraph.com/t/structured.md)

## Examples

- PL: ShareGPT · format OpenAI/HF · ChatML · Alpaca
- EN: ShareGPT · OpenAI/HF format · ChatML · Alpaca

## Related topics

Untyped, symmetric "see also" links.

- [Uruchamianie własnych modeli (Self-hosted model inference)](https://aiatlasgraph.com/t/selfhosting.md)

## Sources

- [LLM Course (Maxime Labonne)](<https://github.com/mlabonne/llm-course>) `mlabonne-llm-course` · by Maxime Labonne

---

AI Atlas revision 122 (2026-10-30) · HTML: https://aiatlasgraph.com/t/chattemplates · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-10-30
