Skip to content
AI.info

Natural language processing

Large Language Models in the NLP Toolkit

Place large language models alongside classifiers, retrievers, parsers, rules, and human workflows for practical NLP systems.

By the end you can

An LLM is a component family, not a product architecture

The same model can classify an intent, extract a record, rerank passages, summarize a case, translate a reply, or generate a question; these capabilities do not decide which action is permitted, which evidence is authoritative, or how failures are contained.

A useful design names the LLM’s role and surrounds it with data, interfaces, validation, evaluation, and fallback.

The model that made this a practical question got one sentence at NeurIPS in 2020. Brown and colleagues “train GPT-3, an autoregressive language model with 175 billion parameters”. They then apply it to every task “without any gradient updates or fine-tuning”. Tasks and few-shot demonstrations are “specified purely via text interaction with the model”. One artefact, many tasks, no per-task training. Nothing in that sentence names an authoritative source or an allowed action.

Broad language capability does not eliminate the need for narrow operational contracts.

Visual

What remains outside the language model

The surrounding system carries obligations that next-token prediction does not provide automatically: model output, then validation and grounding, then decision and authorization, then operations and governance.

The validation layer is not a precaution invented by cautious architects. In 2023 six researchers showed that instructions planted in text a model will later read can take the model over. They called it indirect prompt injection, and they did not stop at a threat model. Their abstract reports: “We demonstrate our attacks' practical viability against both real-world systems, such as Bing's GPT-4 powered Chat and code-completion engines, and synthetic applications built on GPT-4.”

The attacker in that setting never touches the prompt box. NIST built its 2025 taxonomy of these attacks on that paper, and states the mechanism in the agency's own words: “Because GenAI models combine the data and instruction channels, attackers can leverage the data channel to affect system operations by manipulating resources with which the system interacts.” The harms NIST classifies there are availability, integrity and privacy violations. They are mounted by a third party, not by the model's own user. That is precisely why they cannot be handled inside the model output layer. A retrieved page, a parsed document, a tool result: each is text the model may read as instruction unless something standing between output and action refuses to let it.

FigureLayers · 4 layers
  1. 01

    Model output

    Text, scores, token probabilities, structured candidates, or tool proposals.

  2. 02

    Validation and grounding

    Schemas, source support, identifiers, calculations, and policy checks.

  3. 03

    Decision and authorization

    Thresholds, permissions, confirmations, rate limits, and human authority.

  4. 04

    Operations and governance

    Logging policy, monitoring, incident response, retention, evaluation, and change control.

Comparison

Roles an LLM can play in NLP

Each role should be compared with a smaller or more deterministic alternative: direct predictor, generator or editor, retrieval orchestrator, tool planner, data and evaluation assistant.

Two of those rows have documented failure profiles rather than cautionary ones. The tool planner's warnings — authorization, side-effect risk, separating parse from execution — describe a vulnerability class with a catalogue number. OWASP lists it in its Top 10 for LLM Applications 2025 as LLM06:2025 Excessive Agency, and defines it: “Excessive Agency is the vulnerability that enables damaging actions to be performed in response to unexpected, ambiguous or manipulated outputs from an LLM, regardless of what is causing the LLM to malfunction.” Three root causes follow: excessive functionality, excessive permissions and excessive autonomy. One of them is an application that “fails to independently verify and approve high-impact actions”. NIST makes the same point about agents: “However, because agents can take actions using tools, these attacks can create additional risks in this context, such as enabling actors to hijack agents to execute arbitrary code or exfiltrate data from the environment in which they are operating.”

The retrieval orchestrator's obligation to expose sources has a measured number behind it. In October 2025 the EBU and the BBC published an audit of how AI assistants handle news. Journalists at 22 public service media organisations, in 18 countries and 14 languages, graded 2,709 responses from the free versions of ChatGPT, Copilot, Gemini and Perplexity, collected in late May and early June 2025. The headline finding is one line: “Overall, 45% of all AI responses were found to have at least one ‘significant’ issue.” Some 81% carried an issue of some form. The single biggest cause of significant issues was sourcing, at 31%. Gemini showed a significant sourcing issue in 72% of its responses; every other assistant stayed below 25%. The leading defect in a multi-market audit was not fluency. It was provenance — the one property the orchestrating layer, not the model, is responsible for carrying.

FigureComparison · 5 columns

Direct predictor

Return a label, span, score, or structured record.

  • Prompt or fine-tune
  • Flexible schema descriptions
  • Needs output validation
  • Compare with task models

Generator or editor

Draft, rewrite, summarize, translate, or explain.

  • Natural interface
  • Support and style controls
  • Variable outputs
  • Human review may help

Retrieval orchestrator

Rewrite queries, choose sources, rerank, or synthesize evidence.

  • Improves flexible search
  • Can distort user need
  • Must expose sources
  • Candidate recall still matters

Tool planner

Propose typed functions and arguments.

  • Connects language to actions
  • Requires authorization
  • Side-effect risk
  • Separate parse from execution

Data and evaluation assistant

Suggest labels, tests, rubrics, or error clusters.

  • Scales review support
  • Can reproduce model bias
  • Needs sampled validation
  • Never sole ground truth

Example

When an LLM may or may not earn its place

Connect what the model can do to a diagnosed product need. What happens when nobody does is a matter of court record.

Two attorneys filed six judicial opinions that did not exist. ChatGPT had produced them, with fake quotes and fake citations. Ruling on sanctions in Mata v. Avianca on 22 June 2023, Judge P. Kevin Castel opened by conceding the tool: “Technological advances are commonplace and there is nothing inherently improper about using a reliable artificial intelligence tool for assistance.” He then fined the two attorneys and their firm $5,000, jointly and severally, payable into the Registry of the Court within 14 days. They also had to write to the client, and to each judge falsely named as the author of a fabricated opinion.

Every one of those citations was well formed. Nothing in the generated text marked which of them pointed at a case that existed. Only a lookup against an authorized source could have.

  • Few labeled examples and evolving instructions: prompting may create a fast prototype for evaluation.
  • Stable high-volume routing: a smaller classifier may be cheaper, faster, and easier to calibrate, and small no longer implies conceding the task — a 3.8-billion-parameter model cleared in 2024 a bar that took 540 billion in 2022.
  • Complex extraction with variable schemas: constrained generation can help if every field is validated against evidence.
  • Exact identifiers and current policy: lexical retrieval and authorized sources remain essential — the six opinions in Mata v. Avianca were fluent, correctly formatted, non-existent, and cost $5,000.
  • High-consequence action: the LLM may draft or propose, while deterministic authorization controls execution; OWASP files the alternative as LLM06:2025 Excessive Agency.
  • Low-resource language: transfer may help, but direct local evaluation is required before claiming support — the EBU and BBC study evaluated 2,709 responses across 18 countries and 14 languages rather than assuming one market's result carried.

Analogy

A versatile contractor inside a regulated facility

A contractor on a regulated site can write, translate, search, summarize, and propose plans, but must use approved documents, badges, tools, and sign-off procedures.

A contractor carries personal responsibility and a stable understanding of the institution; a language model has neither. Broad skill still does not confer authority.

Capability should be bounded by evidence, interfaces, permissions, and accountable review.

Key idea

A prompt is an interface specification, not a reliability layer

Clear instructions, examples, delimiters, schemas, and context can improve behavior; prompt wording remains sensitive to model version, hidden context, adversarial input, and ambiguous requirements.

Use prompts as versioned artifacts with evals, not as magical policies. That security and authorization must be enforced outside the model response is not this lesson's preference. It is what two independent bodies publish in their own words. OWASP ranks Prompt Injection first in its Top 10 for LLM Applications 2025, as LLM01:2025, and writes under “Prevention and Mitigation Strategies”: “Given the stochastic influence at the heart of the way models work, it is unclear if there are fool-proof methods of prevention for prompt injection.”

NIST's 2025 taxonomy of attacks on machine learning reaches the same operating conclusion. It advises that “because current mitigations do not offer full protection against all attacker techniques, application designers may design systems with the assumption that prompt injection attacks are possible if a model is exposed to untrusted input sources”. A control that the standards body responsible for it will not call fool-proof, and that a federal agency tells designers to assume has failed, cannot be the layer that holds.

Instructions influence output; they do not guarantee obedience, truth, or safe execution.

Case

Reordering the same examples moves a model from near state of the art to random

Hold a set of few-shot examples fixed and shuffle them. The information does not change. The score does. Lu and colleagues measured that at ACL in 2022. They “demonstrate that the order in which the samples are provided can make the difference between near state-of-the-art and random guess performance”. The effect “is present across model sizes (even for the largest current models)”. And “a given good permutation for one model is not transferable to another”. A prompt that survives a model version change is a finding, not an assumption.

Steps

Decide whether to use an LLM for an NLP task

The comparison should start from the task and consequence rather than current fashion: establish a strong task baseline, identify the unmet requirement, define the LLM role and boundary, evaluate complete behavior, then choose the smallest defensible system.

The last step is the one fashion resists, and the size axis has moved fast enough to make “use the biggest model” a poor default. Stanford HAI's 2025 AI Index sets the baseline in its Technical Performance chapter: “In 2022, the smallest model registering a score higher than 60% on MMLU was PaLM, with 540 billion parameters.” Two years later Microsoft's Phi-3-mini crossed the same threshold with 3.8 billion. That is a 142-fold reduction in about two years. Microsoft's own 2024 technical report puts Phi-3-mini at 69% on MMLU and 8.38 on MT-bench, in a model small enough to run on a phone.

Step 1 and step 5 therefore have to be re-run, not remembered. A baseline that lost to a frontier model on last year's numbers may win on this year's, at a fraction of the latency, cost and exposure.

FigureProcess · 5 steps
  1. 1. Establish a strong task baseline

    Use rules, sparse models, encoders, retrieval, templates, or human workflow.

  2. 2. Identify the unmet requirement

    Examples include schema variability, multilingual transfer, generation, or low-data adaptation.

  3. 3. Define the LLM role and boundary

    Specify inputs, evidence, outputs, prohibited actions, and fallback.

  4. 4. Evaluate complete behavior

    Test quality, support, calibration, slices, latency, cost, privacy, and attacks.

  5. 5. Choose the smallest defensible system

    Prefer complexity only when measured value exceeds operating and risk costs.

This path and the Generative AI path ask different questions

Here, LLMs are one option inside the wider NLP toolkit and are compared with established language methods; the focus is task choice, evidence, and linguistic failure analysis.

The Generative AI path examines prompting, fine-tuning, RAG, tool use, serving, safety, and product architecture in greater depth. Keeping the scopes distinct prevents every NLP problem from being reframed as an LLM problem.

NLP defines the language task; Generative AI deepens one important family of solutions.

Write an LLM adoption decision, including a rejection path

Choose one classification, extraction, translation, or summarization feature. Compare a strong specialized baseline with an LLM under the same data and evaluation set.

Quantify quality, latency, throughput, cost, review, update effort, privacy, and severe failure. State the evidence that would make you reject or restrict the LLM option. Then name the failure you would have to survive: a fabricated identifier reaching a filing, as in Mata v. Avianca; a retrieved document carrying instructions, as the indirect prompt injection work demonstrated against deployed systems; a sourcing defect of the kind that caused 31% of the significant issues the EBU and BBC found.

A credible adoption memo includes conditions under which the fashionable solution loses.

Key takeaways