Các mô hình điều chỉnh hướng dẫn (IT) của Gemma được huấn luyện bằng một trình định dạng cụ thể. Trình định dạng này chú thích tất cả ví dụ về việc điều chỉnh hướng dẫn bằng thông tin bổ sung, cả tại thời điểm huấn luyện và suy luận. Trình định dạng có hai mục đích:
Cho biết vai trò trong cuộc trò chuyện, chẳng hạn như vai trò hệ thống, người dùng hoặc trợ lý.
Xác định lượt nói trong một cuộc trò chuyện, đặc biệt là trong một cuộc trò chuyện nhiều lượt nói.
Dưới đây, chúng ta chỉ định mã thông báo điều khiển mà Gemma sử dụng và các trường hợp sử dụng của mã thông báo đó. Xin lưu ý rằng các mã thông báo điều khiển được dành riêng cho trình tạo mã thông báo của chúng tôi.
Mã thông báo cho biết lượt chuyển của người dùng: user
Mã thông báo cho biết một lượt chuyển đổi mô hình: model
Mã thông báo cho biết thời điểm bắt đầu lượt thoại: <start_of_turn>
Mã thông báo cho biết thời điểm kết thúc lượt trò chuyện: <end_of_turn>
Dưới đây là một ví dụ về cuộc trò chuyện:
<start_of_turn>user
knock knock<end_of_turn>
<start_of_turn>model
who is there<end_of_turn>
<start_of_turn>user
Gemma<end_of_turn>
<start_of_turn>model
Gemma who?<end_of_turn>
Mã thông báo "<end_of_turn>\n" là dấu phân cách lượt rẽ và tiền tố lời nhắc là "<start_of_turn>model\n". Điều này có nghĩa là nếu muốn nhắc mô hình bằng một câu hỏi như "Quy tắc Cramer là gì?", bạn nên cung cấp cho mô hình như sau:
"<start_of_turn>user
What is Cramer's Rule?<end_of_turn>
<start_of_turn>model"
Xin lưu ý rằng nếu muốn tinh chỉnh các mô hình Gemma được huấn luyện trước bằng dữ liệu của riêng mình, bạn có thể sử dụng bất kỳ giản đồ nào như vậy cho mã thông báo kiểm soát, miễn là giản đồ đó nhất quán giữa các trường hợp sử dụng huấn luyện và suy luận.
Hướng dẫn về hệ thống
Các mô hình được điều chỉnh theo hướng dẫn của Gemma được thiết kế để chỉ hoạt động với hai vai trò: user và model. Do đó, vai trò system hoặc lượt chuyển của hệ thống không được hỗ trợ.
Thay vì sử dụng một vai trò hệ thống riêng biệt, hãy cung cấp hướng dẫn cấp hệ thống ngay trong lời nhắc ban đầu của người dùng. Các chức năng sau đây của hướng dẫn mô hình cho phép Gemma diễn giải các hướng dẫn một cách hiệu quả. Ví dụ:
<start_of_turn>user
Only reply like a pirate.
What is the answer to life the universe and everything?<end_of_turn>
<start_of_turn>model
Arrr, 'tis 42,<end_of_turn>
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-03-21 UTC."],[],[],null,["# Gemma formatting and system instructions\n\nGemma instruction-tuned (IT) models are trained with a specific *formatter* that\nannotates all instruction tuning examples with extra information, both at\ntraining and inference time. The formatter has two purposes:\n\n1. Indicating roles in a conversation, such as the *system* , *user* , or *assistant* roles.\n2. Delineating turns in a conversation, especially in a multi-turn conversation.\n\nBelow, we specify the control tokens used by Gemma and their use cases. Note\nthat the control tokens are reserved in and specific to our tokenizer.\n\n- Token to indicate a user turn: `user`\n- Token to indicate a model turn: `model`\n- Token to indicate the beginning of dialogue turn: `\u003cstart_of_turn\u003e`\n- Token to indicate the end of dialogue turn: `\u003cend_of_turn\u003e`\n\nHere's an example dialogue: \n\n \u003cstart_of_turn\u003euser\n knock knock\u003cend_of_turn\u003e\n \u003cstart_of_turn\u003emodel\n who is there\u003cend_of_turn\u003e\n \u003cstart_of_turn\u003euser\n Gemma\u003cend_of_turn\u003e\n \u003cstart_of_turn\u003emodel\n Gemma who?\u003cend_of_turn\u003e\n\nThe token `\"\u003cend_of_turn\u003e\\n\"` is the turn separator, and the prompt prefix is\n`\"\u003cstart_of_turn\u003emodel\\n\"`. This means that if you'd like to prompt the model\nwith a question like, \"What is Cramer's Rule?\", you should instead feed the\nmodel as follows: \n\n \"\u003cstart_of_turn\u003euser\n What is Cramer's Rule?\u003cend_of_turn\u003e\n \u003cstart_of_turn\u003emodel\"\n\nNote that if you want to finetune the pretrained Gemma models with your own\ndata, you can use any such schema for control tokens, as long as it's consistent\nbetween your training and inference use cases.\n\nSystem instructions\n-------------------\n\nGemma's instruction-tuned models are designed to work with only two roles:\n`user` and `model`. Therefore, the `system` role or a system turn is not\nsupported.\n\nInstead of using a separate system role, provide system-level instructions\ndirectly within the initial user prompt. The model instruction following\ncapabilities allow Gemma to interpret the instructions effectively. For example: \n\n \u003cstart_of_turn\u003euser\n Only reply like a pirate.\n\n What is the answer to life the universe and everything?\u003cend_of_turn\u003e\n \u003cstart_of_turn\u003emodel\n Arrr, 'tis 42,\u003cend_of_turn\u003e"]]