A prompt template is a reusable structure whose instructions shape both fine-tuning results and the input ultimately sent to a model. section 12.2.2
When designing a template, account for:
- Instruction wording, because changes can alter how closely generated results align with expected outputs. section 12.2.2
- Tokenization, because the tokenizer must align with the model used for tuning. section 12.2.2
- Context length, because prompts and training data must fit within the model’s token-processing limit. section 12.2.2
Code-generation template example
An instruction can ask, “How does the method initialiseMocks work for BrandingServiceTest?” and require compilable code. A corresponding output is a JSON instruction paired with a Java method using MockitoAnnotations.openMocks(this). section 12.2.2
{
"instruction" : "How does the method initialiseMocks work for
➥BrandingServiceTest?"
"output" : "@BeforeEach public void initialiseMocks() {
➥MockitoAnnotations.openMocks(this); }"
}
Inspect the instruction-and-output listing to see the training example structure. section 12.2.2




















