AlphaEvolve guides its operations by utilizing the provided code baseline as
well as the specific context provided by the user.

## User context

The user-provided context is injected into every generation prompt. It balances
the search space by providing the LLM with domain knowledge, mathematical
formulations, and system constraints.

- Token budget: Up to 200,000 tokens performs well. Beyond a 200k token threshold, the context window becomes loaded, the LLM's attention is decreased, and the mutation quality is reduced. If your combined context (problem description, code, and previous programs) exceeds 200k tokens, then you must reduce it.

### What to include

- Precise mathematical formulation of the optimization problem.

- Key constraints and their clear rationale.

- Domain-specific terminology and definitions.

- Known good approaches or prior art to guide the LLM's search direction.

- Specific, explicit instructions detailing what NOT to do.

### What NOT to include

- General programming tutorials.

- Standard library documentation (the LLM already knows `numpy`, `sklearn`,
  etc.). However, DO include documentation for niche or domain-specific
  libraries the LLM might not know well (custom kernel APIs, proprietary
  SDKs, or specialized DSLs).

- Raw arbitrary data, spreadsheets, or large data dumps. Data belongs in
  the evaluator harness, not in the prompt context.

- Unrelated context that consumes tokens without adding a search signal.

Every piece of context you include must deliver clear value by actively helping
the LLM produce better, structurally sound mutations.

## Evaluation feedback (Insights)

After each execution loop, the evaluator can return diagnostic feedback text
alongside numerical scores. This feedback is automatically appended to future
prompt structures.

- Quality baseline: Strong feedback is specific, actionable, and concise.
  Poor feedback is generic (such as *"evaluation failed"*) or excessively
  verbose.

- Operational purpose: These insights are displayed to the LLM in
  subsequent generations, allowing it to learn explicitly from execution
  failures and avoid repetitive bugs.

## Built-in prompt diversification

AlphaEvolve automatically diversifies the prompts it transmits to the backend
LLM ensemble. This operation is handled internally and requires no manual user
configuration.

The system varies its core instructions across successive generations to
encourage diverse mutations and prevent the LLM from falling into repetitive
coding patterns. This behavior serves as one of the primary mechanisms helping
AlphaEvolve explore a broad landscape rather than getting trapped in narrow
local optima.

## Code readability

Code complexity acts as an effective auxiliary metric. If final code
readability is a factor for your production use case, consider adding code
length or cognitive complexity as a secondary target metric.

AlphaEvolve can achieve up to 50% file compression without degrading functional
performance. However, the LLM will exploit naive simplicity metrics (such as
removing all inline comments to reduce raw character counts). To prevent this,
implement metrics that capture meaningful structural complexity, such as
cyclomatic complexity or Abstract Syntax Tree (AST) node counts, rather than
evaluating raw string lengths.