WhoBuilt

CI in the Era of AI: From Unit Tests to Stochastic Evals

Jun 27, 2025· 15 min· 871 views·Watch on YouTube

Speaker

Nathan Sobo, co-founder of Zed, explains at an AI Engineer talk how Zed tested its AI agent’s search and streaming edits, from deterministic unit tests to repeated stochastic evaluations.

Why AI changed Zed’s testing approach

Sobo says Zed relies on extensive empirical testing, including replayable tests of concurrent network events. LLM behavior introduced a new challenge: even small input changes can produce very different outputs, so testing could no longer rely on determinism alone.

From broad evals to specific failures

Zed began with data-driven evaluations that ran an agent in a headless copy of the editor, then added programmatic assertions about its actions. A broad evaluation exposed a weak grep tool; using Tree-sitter to expand search matches to syntactic boundaries improved the agent’s results.

Repeated evals and deterministic building blocks

For streaming edits, Zed asked the model to describe changes and then emit old-text and new-text blocks. Some evaluations were run 200 times, with a requirement that all 200 pass. Failures led to deterministic tests for bounded issues such as arbitrary text chunking, fuzzy matching, and streaming diffs.

Making edit parsing resilient to model output

The team tested cases where the model emitted empty old-text tags, mismatched XML tags, or flattened indentation. Prompt changes reduced mismatched tags from about 40% to 5%, while deterministic tests checked that the parser handled malformed tags and indentation differences. Sobo also described escaping problems with Rust raw strings that a prompt fix had helped address.

A practical testing loop for AI features

Sobo’s approach starts with a broad evaluation, narrows to a stochastic test of a specific behavior, and then turns discovered failures into ordinary deterministic tests where possible. Zed ran these checks in its existing test suite without a separate eval framework, using pass-rate thresholds for stochastic behavior.

Takeaways

  • Start with a broad end-to-end eval to find where an AI feature fails.
  • Turn each repeatable failure into a focused test, and make that test deterministic when possible.
  • Use repeated runs and explicit pass-rate thresholds to measure stochastic behavior.
  • Test the boundaries of model-generated output, including malformed tags, indentation changes, and partial streams.
  • Keep AI evaluations in the existing test workflow when it already supports the needed runs and assertions.

Mentioned in this talk

Search inside this talk

What was claimed 8

  • founded
    “I’m Nathan Sobo, co-founder of Zed.”
    YouTube
    Verified3 sources· Talk, Web· archived
  • feature
    Zed: AI-enabled code editor implemented from scratch, not a fork of VS Code
    “We’re an AI-enabled code editor, and what sets us apart is that we’re not a fork of VS Code. We’re implemented from scratch.”
    YouTube
    Unverified1 source· Talk
  • uses
    Zed uses Rust
    “We implemented it from scratch in Rust.”
    YouTube
    Unverified1 source· Talk
  • launched
    “we launched Agentic Editing in Zed”
    YouTube
    Unverified1 source· Talk
  • metric
    Zed: Tens of thousands of tests
    “We probably have tens of thousands of tests at this point.”
    YouTube
    Unverified1 source· Talk
  • uses
    “Then we use Tree-sitter, Max’s parsing framework, to expand the match to the syntactic boundaries.”
    YouTube
    Unverified1 source· Talk
  • feature
    Zed: Agentic Editing supports streaming edits and agent search
    “trying to implement streaming edits or an agent that can search and edit”
    YouTube
    Unverified1 source· Talk
  • uses
    “with the Claude 4 models, I’m finally able to write Rust agentically”
    YouTube
    Unverified1 source· Talk

Related talks