EEVEE introduces a new paradigm for prompt engineering. It treats the prompt‑routing problem and the prompt‑design problem as a single coupled system. By evolving them together, EEVEE eliminates the cross‑dataset interference that has plagued multi‑benchmark prompt optimization.

The Problem of Cross‑Dataset Interference

Traditional prompt optimization runs a single optimizer on a mixed dataset that contains many different tasks. A prompt that improves performance on one sub‑task often harms performance on another. Researchers have observed that when the optimizer treats the dataset as a monolith, the resulting prompt reaches a plateau well below the theoretical optimum. The phenomenon is called cross‑dataset interference.

Router‑Prompt Co‑Evolution

EEVEE solves interference by separating the data stream into task streams. A lightweight router predicts which stream a new example belongs to. Each stream receives its own specialized prompt configuration. The router and the prompts evolve together in a co‑training loop:

  1. Initialize a generic router and a base prompt.
  2. Assign each training example to the router’s current best stream.
  3. Optimize the prompt for each stream using a gradient‑free evolutionary algorithm.
  4. Update the router’s classifier with the new stream assignments.
  5. Iterate until validation scores converge.

The loop treats the router as a meta‑prompt that decides how to apply downstream prompts. By coupling their updates, EEVEE avoids the tug‑of‑war that occurs when a single prompt must satisfy contradictory objectives.

Architecture Details

EEVEE’s router is a shallow feed‑forward network with a 256‑dimensional hidden layer. It receives the raw input tokens, a token‑level embedding from the target LLM, and a one‑hot task identifier when available. The router outputs a softmax over K streams, where K is dynamically selected by a Bayesian information criterion during training.

Each stream’s prompt consists of three parts:

  • System Prompt – a high‑level persona description.
  • Few‑Shot Demonstrations – up to eight examples curated for the stream.
  • Instruction Header – a concise task‑specific command.

EEVEE stores these components in a structured JSON schema. The evolutionary search mutates strings, swaps examples, and reorders sections. Mutations are scored by a fitness function that aggregates benchmark scores across the stream’s validation set.

Empirical Results

The authors evaluated EEVEE on eight public benchmarks covering reasoning, coding, and knowledge retrieval. They compared against three baselines:

  • Qwen‑3‑4B – a strong open‑source model with a single prompt.
  • DeepSeek‑V3.2 – a proprietary model tuned with standard prompt‑engineering.
  • GEPA and ACE – state‑of‑the‑art genetic prompt optimizers that do not use routing.

EEVEE achieved the following average score improvements over the baselines:

Baseline Avg. Score ↑
Qwen‑3‑4B +10.38
DeepSeek‑V3.2 +24.32
GEPA (best stream) +37.0
ACE (best stream) +48.4

The gains are consistent across all eight benchmarks. In the code generation benchmark, EEVEE lifted the pass@1 metric from 48 % to 66 %. In the reasoning benchmark, it raised the exact match from 32 % to 45 %.

Practical Takeaways for Prompt Engineers

  1. Segment Your Data – Before running any optimizer, cluster your examples by task similarity. Simple heuristics such as keyword matching or embedding‑based K‑means often suffice.
  2. Deploy a Router – A lightweight classifier can be trained on a few hundred labelled examples. Use the router to direct new queries to the appropriate prompt.
  3. Co‑Train Router and Prompts – Treat the router’s assignments as part of the fitness signal. When a prompt improves, feed the improvement back to the router.
  4. Modular Prompt Design – Store system prompts, demonstrations, and instructions separately. This makes mutation cheap and keeps the search space tractable.
  5. Dynamic Stream Count – Let the system decide how many streams to keep. Too many streams fragment data; too few re‑introduce interference.
  6. Evaluation Granularity – Track per‑stream metrics. If a stream stagnates, either merge it with a neighboring stream or add more examples.
  7. Deployment Simplicity – At inference time, the router adds < 5 ms latency on a standard CPU. The per‑stream prompts are cached, so runtime cost is negligible.

Code Sketch

Below is a minimal Python snippet that reproduces the core EEVEE loop using the transformers library and NumPy. It assumes you have a pretrained LLM named model and a tokenizer tok.

import numpy as np
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('princeton/EEVEE-base')
tok = AutoTokenizer.from_pretrained('princeton/EEVEE-base')

# Simple router: linear layer + softmax
router_w = np.random.randn(768, 4)  # 4 streams
router_b = np.zeros(4)

# Prompt store per stream
prompts = [{
    'system': "You are an expert mathematician.",
    'shots': [],
    'instruction': "Solve the problem."
} for _ in range(4)]

def router(x):
    h = x @ router_w + router_b
    return np.exp(h) / np.exp(h).sum(axis=1, keepdims=True)

def generate(stream_id, input_ids):
    cfg = prompts[stream_id]
    prompt = cfg['system'] + "\n" + "\n".join(cfg['shots']) + "\n" + cfg['instruction']
    ids = tok(prompt, return_tensors='pt').input_ids
    out = model.generate(ids, max_new_tokens=64)
    return tok.decode(out[0], skip_special_tokens=True)

# Co‑evolution loop (pseudo‑code)
for epoch in range(20):
    # 1. assign examples to streams
    assignments = []
    for ex in train_examples:
        emb = model.encode(ex['input'])  # pseudo‑function
        probs = router(emb)
        stream = probs.argmax()
        assignments.append(stream)
    # 2. evolve prompts per stream (simple mutation)
    for s in range(4):
        # evaluate current prompt on its assigned examples
        scores = []
        for ex, a in zip(train_examples, assignments):
            if a == s:
                pred = generate(s, ex['input'])
                scores.append(metric(pred, ex['target']))
        # if score improves, keep mutation
        # mutation: add a random few‑shot example
        new_shot = random.choice(candidate_shots)
        prompts[s]['shots'].append(new_shot)
    # 3. retrain router on new assignments
    # (simple logistic regression update omitted)

The snippet omits many engineering details—such as batching, gradient‑free search, and evaluation metrics—but it captures the essential feedback loop.

Future Directions

  • Hybrid Routing – Combine rule‑based routing with learned routing for domains with strong ontologies.
  • Meta‑Learning – Pre‑train the router on a corpus of prior tasks so it can bootstrap new task streams with fewer examples.
  • Multi‑Modal Extensions – Extend EEVEE to vision‑language models by feeding image embeddings into the router.
  • Adaptive Stream Merging – Dynamically merge streams when their performance converges, reducing memory overhead.

Conclusion

EEVEE demonstrates that prompt engineering benefits from treating routing as a first‑class citizen. By co‑evolving routers and prompts, it delivers consistent double‑digit gains over strong baselines and outperforms prior genetic optimizers by up to nearly fifty percent. Prompt engineers can adopt EEVEE today by segmenting their data, deploying a lightweight router, and running a simple evolutionary search on per‑stream prompts. The approach scales to any LLM and any heterogeneous task collection, making it a practical tool for the next generation of prompt‑driven applications.