ChatGPT is a conversational AI system that understands and generates human-like text. It is powered by GPT, a generative pre-trained transformer trained on very large volumes of internet text for language modeling: predicting what word or sequence is likely to follow preceding text. That capability supports text tasks including translation, summarization, question answering, sentiment analysis, and phishing detection. section 5.0 section 5.2.1
A language model learns probabilistic patterns from a text corpus: which words and sequences tend to occur together and which do not. Given “French is a beautiful <blank>,” it can assign a higher probability to “language” than “country.” GPT generates text autoregressively, repeatedly selecting or sampling a likely next word from a distribution conditioned on prior words. section 5.2.1
Figure 5.7 Toy example of how an LLM predicts the next word (given the preceding words) by sampling from a distribution of likely words. In this example, the LLM always chooses the most likely next word – called the greedy search approach.
This toy prediction sequence makes next-word probabilities and greedy selection concrete: the model repeatedly chooses the most likely continuation. section 5.2.1
For phishing detection, ChatGPT can inspect an email and classify it as phishing or genuine, then explain its reasoning. It extends rule-based and classical-machine-learning approaches by working directly with language and by using knowledge acquired during broad language-model training. Its judgments remain limited by what it learned and by the tools available to it. section 5.0 section 5.2
A ghost-domain phishing email
An email from emailinspector.net can be misclassified as genuine when ChatGPT has not encountered that domain during training. A ChatGPT 3.5 demonstration does not open a browser to test whether the website exists. One-shot prompting addresses this failure by first supplying an example of genuine and phishing email patterns, then asking for a classification of the target email; the same email is then detected as phishing. section 5.2.4
Prompt engineering can adapt a phishing decision without retraining the underlying model:
- Identify a failure case and the missing pattern, such as an unrecognized nonexistent domain. section 5.2.4
- Provide one labeled example that represents the genuine-versus-phishing pattern. section 5.2.4
- Ask for a classification of the new email using that example as context. section 5.2.4
One-shot learning uses a single or very limited number of examples; few-shot learning generalizes the idea to a small set. These techniques can teach ChatGPT a new pattern in the prompt, but they do not remove the need to examine mistakes, especially when a decision depends on information the model has not seen or cannot verify. section 5.2.4
Figure 5.18 One-shot prompting to teach ChatGPT to catch a particular kind of phishing email from a specific domain.
The figure shows the practical before-and-after pattern: add one example to the prompt so a previously missed domain-based phishing pattern is caught. section 5.2.4




















