Most people treat prompting like sending a text message. You write something, the model reads it, you get an answer. The mental model is direct and wrong. What actually happens between your keystrokes and the model’s attention is a layered pipeline of transformations, injections, and structural choices that can fundamentally change what the model is responding to. Understanding those layers isn’t just interesting. It changes what you blame when things go wrong.
1. There Is Almost Always a System Prompt You Can’t See
Every major AI product, from ChatGPT to Claude to Gemini, runs your message inside a larger context that starts before your first word. The system prompt sits at the top of the conversation, invisible to you, and it carries real weight. It shapes the model’s persona, sets constraints, prioritizes certain behaviors, and often pre-loads context about who you are or what product you’re using.
This matters because the model isn’t just answering you. It’s answering you within a frame you didn’t design. If the system prompt says “always respond formally” or “never discuss competitor products” or “you are an assistant for a legal services company and should not give specific legal advice,” those instructions actively compete with yours. When a model seems stubborn or weirdly constrained, the system prompt is often the reason.
Some companies publish their system prompts. Anthropic has shared portions of Claude’s, and leaked screenshots of ChatGPT’s have circulated. Reading them is instructive. They’re long, specific, and full of edge-case handling. The model you’re talking to has already been briefed extensively before you say a word.
2. Tokenization Isn’t Reading
When your prompt enters the model, it doesn’t get processed as words. It gets broken into tokens, which are chunks of text that roughly correspond to syllables, common word fragments, or whole short words. The model operates on token sequences, not sentences. This sounds like an implementation detail. It has real consequences.
The word “unfortunately” is one concept to you and multiple tokens to the model. Unusual spellings, technical jargon, certain names, and non-English text all tokenize in ways that differ from intuition. Token boundaries affect how the model represents meaning internally. Researchers have found edge cases where specific token sequences produce strange outputs precisely because of how they tokenize, not because of what they mean.
The practical implication is that prompts aren’t treated as semantically uniform. A term split across an awkward token boundary may be slightly less salient than one that sits cleanly within common token patterns. This is a subtle effect, but it’s a real one, and it’s one of several reasons that minor prompt rewording can change outputs in ways that feel disproportionate.
3. Context Position Changes How Much Attention a Token Gets
The transformer architecture that underlies most modern language models uses attention mechanisms to weigh relationships between tokens. In practice, this means position in the context window matters. Content at the beginning and end of a long context tends to get more attention than content buried in the middle. This is sometimes called the “lost in the middle” problem, and it has been documented in research on long-context models.
For most short prompts, this doesn’t matter much. But if you’re feeding a model a long document and asking it to summarize, or pasting in a codebase and asking about a specific function, where your instruction appears relative to the bulk of the content affects how reliably the model follows it. Putting your key question at the end of a long context often works better than burying it in the middle. This isn’t a quirk you should have to know. But you do, if you want consistent results.
4. Retrieval-Augmented Systems Inject Text Without Announcing It
Many production AI systems don’t just take your raw prompt. They run a retrieval step first: your question gets embedded as a vector, searched against a database of documents, and the top results get silently inserted into the context before the model sees your message. You asked one question. The model is answering a version of that question that now includes several paragraphs of retrieved text you never wrote.
This is how vector search actually shapes AI responses, and it’s the architecture behind most enterprise AI tools. When the retrieval step surfaces the wrong documents, the model confidently answers a slightly different question than the one you asked. The answer can sound completely reasonable while being based on irrelevant source material. Debugging this requires knowing the retrieval layer exists, which users of polished products often don’t.
5. Fine-Tuning and RLHF Encode Invisible Preferences
Beyond the context window, the model’s weights themselves encode training-time preferences that shape output before any prompt is involved. Fine-tuning adjusts the model toward certain response styles, formats, and content norms. Reinforcement learning from human feedback (RLHF) bakes in patterns that human raters preferred during training.
The result is that even a bare, minimal prompt triggers a trained disposition. The model has opinions about how long answers should be, how confident they should sound, when to add caveats, and what topics to handle gingerly. These aren’t neutral defaults. They’re decisions made by the team that trained the model, encoded invisibly. When a model keeps giving you bulleted lists even though you didn’t ask for them, or hedges every answer with “it’s important to note,” that’s fine-tuning talking, not your prompt.
6. Your Prompt Gets Rewritten Sometimes Literally
Some systems include prompt optimization steps where your input is paraphrased or restructured before being sent to the model. Research into automatic prompt optimization (techniques like APE and OPRO) shows that algorithmically rewritten prompts can outperform human-written ones on benchmarks. Whether this is happening to you depends entirely on the product you’re using, and most products won’t tell you.
Even without explicit rewriting, the model’s response to your prompt is shaped by all the above: the system context, the tokenization, the position effects, the retrieved documents, and the trained dispositions. The version of your prompt that actually produces an output is a composite artifact. Writing better prompts is genuinely useful, but the more leveraged skill is understanding the pipeline well enough to diagnose what layer is failing when the output is wrong. That’s not intuition. It’s engineering.