A prompt is input supplied to a generative model to condition what it produces. In GPT-style generation, the input words establish a preceding sequence; the decoder then predicts one word or token at a time, adds it to the sequence, and uses the expanded sequence to predict the next token. section 5.2.1
Prompt content can also constrain output format. For phishing triage, an email and an instruction requiring a strictly yes-or-no answer guide ChatGPT toward a usable verdict. Designing such instructions and constraints is prompt engineering. A correct-looking verdict still warrants checking whether the model used relevant email characteristics rather than bluffing. section 5.2.2
Prompts serve different roles across generative workflows:
- Text generation: a few input words, including a start token, seed a GPT decoder's continuation. section 5.2.1
- Phishing classification: email text plus an explicit response constraint asks ChatGPT to label an email as phishing or genuine. section 5.2.2
- Document extraction: the trigger prompt <s> is fed to a DONUT decoder alongside an ID image so generation of the image text can begin. section 7.3.3
Starting structured ID extraction
A fine-tuned DONUT model receives a Slovakian ID image through its encoder and <s> through its decoder. The trigger prompt starts generation of a raw text sequence, which is post-processed into JSON fields such as name, nationality, dates, and ID number. At prediction time, the same task prompt is tokenized and passed as decoder input before calling generation. section 7.3.3 section 7.3.4
Figure 7.27 Schematic of finetuning the DONUT model on the labeled Slovakian ID dataset. Inputs to the DONUT model are the Slovakian ID image (to the encoder) as well as a prompt text (to the decoder). The prompt text triggers the decoder to start generating the text that is written inside the ID image. Raw generated text is in a DONUT-friendly format which is then converted to JSON format.
This diagram shows the split inputs: an ID image enters the encoder, while prompt text enters the decoder to trigger generated extraction text before JSON conversion. section 7.3.3































































