A large language model (LLM) learns patterns in text by training on huge volumes of language data. Its core task is language modeling: estimate which word or word sequence is likely to follow a preceding sequence. GPT is a transformer-based LLM that generates text autoregressively, one next-token prediction at a time. section 5.0 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.
A next-word distribution makes the central behavior concrete: given preceding words, the model assigns likely continuations and can select the most likely one with greedy search. section 5.2.1
Learning which words occur together lets an LLM produce human-like text and support translation, summarization, question answering, and sentiment analysis. That broad text capability can be redirected to fraud work, including deciding whether an email is phishing or genuine. section 5.0 section 5.2.1
Phishing classification with prompting
An LLM can initially misclassify a phishing email. One-shot prompting supplies one genuine-email example and one phishing-email example before the target email, enabling ChatGPT to recognize a previously missed pattern. An application can send full email data and a detection prompt to the ChatGPT API, then use its yes/no result, explanation, or requested confidence score; a confidence threshold can tune precision, recall, and pass rate. section 5.2.4
LLMs can be put into a phishing workflow in two practical ways:
- Use HuggingFace-hosted models from Python; access requires a HuggingFace account and API token. section 5.3
- Use LangChain to run prompts and one-shot or few-shot prompt-engineering workflows. section 5.3
- Load a locally downloaded Mistral model through GPT4All and LlamaCpp, avoiding an API token; configure model path, context length, batching, GPU layers, and temperature. section 5.4.1
























































































