juppiter journal juppiter.com RSS

Retrieval and context

What Is Context Engineering? A Guide for Teams Using AI on Firm Data

What is context engineering? Choosing what a model sees for each task. Why it decides AI quality at hedge funds, family offices and PE firms.

Dark title card reading What is context engineering? with a context window drawn as stacked bars, one highlighted in blue.

Context engineering is the practice of deciding what a language model sees when it answers: which instructions, which documents, which facts, which tool results and which history go into the model's limited window, in what form and in what order. Anthropic frames the question as "what configuration of context is most likely to generate our model's desired behavior?" In simple words, prompt engineering is writing the instructions well, and context engineering covers those instructions plus everything else the model is given to work from.

This guide is written for the people who run alternative investment firms: COOs, CTOs, heads of data and research, portfolio managers and analysts at hedge funds, family offices and private equity funds. The position taken here is that context is the part of an AI system that matters most to get right, so a disappointing answer should be traced to the context first.

What is context engineering in simple words?

A language model answers from two places: what it learned in training, and what is placed in front of it for the task at hand. Training is fixed. What is placed in front of it is the context, and it is the part a team can control.

Anthropic defines context as "the set of tokens included when sampling from a large-language model." It defines context engineering as "the set of strategies for curating and maintaining the optimal set of tokens (information) during LLM inference, including all the other information that may land there outside of the prompts."

Andrej Karpathy, endorsing the term, called it "the delicate art and science of filling the context window with just the right information for the next step." He listed what goes into that window: "task descriptions and explanations, few shot examples, RAG, related (possibly multimodal) data, tools, state and history, compacting." Shopify's CEO Tobi Lütke described the core skill as "the art of providing all the context for the task to be plausibly solvable by the LLM." Both are quoted in a note by Simon Willison.

The practical test is simple. Given only what the model was handed, could a capable analyst answer the question? If not, no prompt will fix it.

Context engineering vs prompt engineering

Prompt engineering refers to methods for writing and organizing instructions for a model. Anthropic calls context engineering "the natural progression of prompt engineering." The difference is scope and timing.

  • A prompt is a discrete piece of writing: the instructions, examples and framing for a task.
  • Context is assembled again for every request. As Anthropic puts it, "context engineering is iterative and the curation phase happens each time we decide what to pass to the model."
Diagram. A large box labeled context engineering contains instructions, which is the prompt engineering part, plus tools, examples, retrieved information and history. An arrow leads to the model and then to the answer.

In a simple chat the two look the same. They separate in systems where the model draws on a firm's documents, calls tools and carries a long history. There, the retrieved material is most of what the model reads.

Context engineering vs RAG

RAG, or retrieval-augmented generation, is one technique within context engineering. The original RAG paper by Lewis and colleagues described models that combine a pre-trained model's built-in memory with an external memory the model can search. In practice, RAG means retrieving relevant passages and adding them to the prompt. The basics are covered in What Is RAG?

Karpathy's list places RAG as one item among several that fill the window. RAG decides how outside knowledge gets found. Context engineering decides everything that ends up in front of the model, including whether the retrieved passages belong there, how many, in what order, next to which instructions, and what gets left out.

A firm can have a working RAG pipeline and still get poor answers: too many loosely related passages, passages that do not say which company or period they refer to, or the best evidence buried in the middle.

Why more context is not better context

It is tempting to assume that a larger window solves the problem: put everything in. The evidence points the other way.

Anthropic describes context rot: "as the number of tokens in the context window increases, the model's ability to accurately recall information from that context decreases." It says the effect appears across all models, though some degrade more gently than others, and concludes that context must be treated "as a finite resource with diminishing marginal returns." Its guiding principle is to find "the smallest set of high-signal tokens that maximize the likelihood of your desired outcome."

Position matters too. In "Lost in the Middle," Liu and colleagues tested models on multi-document question answering. They found that performance is often highest when the relevant information is at the beginning or end of the input and degrades significantly when it is in the middle, even for models built for long contexts.

These findings change the goal: supply the right material, in a good order, and little else. That is a retrieval and ranking problem before it is a prompting problem.

What goes into the context window?

Anthropic's description of the anatomy of effective context gives a useful checklist:

  • Instructions. Clear and direct, specific enough to guide behavior but flexible enough to give the model strong heuristics.
  • Tools. Tools define the contract between the model and the outside world, and should return information that is efficient in tokens. Anthropic names bloated tool sets as one of the most common failure modes.
  • Examples. A small set of diverse, canonical examples works better than a long list of edge cases.
  • Retrieved information. Anthropic distinguishes retrieving data before the model runs from "just in time" approaches, in which an agent loads data as it works.
  • History. For long tasks, compaction and note-taking keep the useful parts of earlier work.

For an alternative investment firm, the retrieved information is where most of the effort goes, because the firm's own research, notes, models and documents are what the model has never seen.

Context engineering for enterprise AI

Putting AI on a firm's own data raises problems that general advice skips. Three illustrative scenarios, one per kind of firm:

A hedge fund. An analyst asks what the firm has written about a company's largest supplier. The research notes refer to the company by its ticker, its trade name and a former name, and one analyst's notes use a shorthand of their own. If those are treated as separate strings, a search finds some of the notes and misses others, and the model answers confidently from a partial picture.

A family office. The principal's office asks what the family has committed across fund investments and direct holdings. The answer sits in side letters, capital call notices, manager letters and meeting notes, written in different words by different people over many years. The question turns on connections between an investor, a vehicle and a manager, not on one phrase.

A private equity fund. An associate asks what diligence found about a portfolio company's top customer. Anthropic's Contextual Retrieval work uses a similar example: a chunk saying only that revenue grew over the previous quarter does not say which company or which period. Out of a data room or board deck, a passage like that is easy to retrieve and easy to misuse.

Each scenario is a context problem, not a prompting problem. Some questions turn on exact terms, others on meaning, and others on how things are connected, and no single search method covers all three. Two companion posts take them in turn: Knowledge Graph vs Vector Database for AI covers structure and meaning, and Hybrid Search vs Semantic Search vs Keyword Search covers how the two search methods combine. For a view across the whole firm, see AI for Hedge Funds.

Choosing a vendor is itself a risk decision. The questions to ask before connecting firm data are in AI Vendor Due Diligence Questionnaire: What to Ask Before Connecting Firm Data.

How retrieval fits into context engineering

Think of the work as a chain, where each link limits the next:

  1. Ingestion. Documents are read in segments, embedded, and linked to the entities they mention, so that later steps can find them by meaning, by name or by relationship.
  2. Storage. The text, the embeddings and any structure such as an entity graph are kept in a form that can be searched.
  3. Retrieval. A question is turned into searches, and candidates are found and combined.
  4. Ranking. Candidates are ordered, and weak ones are cut.
  5. Assembly. What survives is placed in the window alongside instructions and any tool results.
Diagram. Five stacked steps with arrows between them: ingestion, storage, retrieval, ranking and assembly, ending with the context placed in the model window.

A weakness early in the chain cannot be repaired later. If ingestion never captured that two names refer to one company, retrieval cannot join them, and no prompt can ask the model to guess. The model sits at the end of the chain, and it can only work with what the chain gives it.

What to look for in a context engineering platform

juppiter is a knowledge engine that securely organizes your firm data for fast and efficient access for your AI workflows. Its own description of the problem is "An AI system is only as good as the context it is given." The Features page maps onto the chain above, and each piece answers a problem the scenarios raised.

  • The same name written many ways. During ingestion, juppiter embeds each segment and resolves the entities in it. Per the Features page, "different references to the same company land on one entity, and the same is true of a person, a brand, a commodity or a theme," so later questions "search one entity rather than a scatter of near matches." That is the hedge fund analyst's ticker, trade name and former name.
  • Questions that turn on connections. Extracted entities are written into an ontology and a knowledge graph of what your firm knows and how it fits together, which "gives retrieval a connected subgraph to search." That is the family office question about an investor, a vehicle and a manager.
  • Meaning and exact terms in one question. Graph search over the relevant entities runs alongside a semantic search of the embeddings, and "the results are pooled and reranked, then returned as context." A question can draw on the entities that matter and on the passages that carry the meaning, which covers the private equity associate's customer question.
  • Passages that lose their source. Sources are read in segments, so later stages can extract meaning and entities "from the parts of a document, not only from the file as a whole."
  • Context assembled by hand. The Features page says analysts and AI workflows work "from that same organized body of knowledge, instead of assembling context by hand from scattered files," and that the aim is "a single ground truth the team can share, built from the firm's own data, rather than a model filling gaps on its own."
  • Control over what goes in. Your team chooses what is ingested, "including which folders to leave out before the first sync."
  • Getting it running. Forward-deployed engineers work with your team through onboarding and implementation, so the first questions run against your firm's own material.

In the terms of this post, juppiter covers the ingestion, storage, retrieval and ranking links of the chain, and returns the reranked context to the AI workflow that asked.

Getting started with context engineering

You do not need new tooling to begin. Pick one workflow where an AI answer matters. Write down ten real questions. For each, find out what the model was actually given: which passages, in what order, with what identifying detail. Where the right passage is missing, weak or buried, the fix is in the context. Repeat after each change.

Read next: What Is RAG?, Knowledge Graph vs Vector Database for AI and Hybrid Search vs Semantic Search vs Keyword Search.

Request a demo

Tell us about your firm and we'll set up a walkthrough of juppiter.