discovering-high-level-patterns
Discovering High-Level Patterns from Simulation Traces
This skill enables Claude to transform verbose, fine-grained simulation logs or event traces into compact, semantically meaningful pattern annotations -- then reason over those annotations using natural language. The core technique, from Memery & Subr (2026), synthesizes executable pattern detector programs that scan raw traces and output boolean activation timelines (e.g., "collision at t=3.2", "stable support from t=5 to t=8"). These annotated traces replace raw numerical data as context for downstream tasks like question answering, reward program generation, and planning -- dramatically improving scalability and LM reasoning accuracy over physics or event-driven domains.
When to Use
- When the user has simulation output (physics engine logs, game replays, robotics telemetry) and wants to identify meaningful events or phases within it
- When building reward functions or fitness functions from natural language goal descriptions for RL or optimization
- When summarizing long time-series logs into human-readable event narratives
- When the user asks to "find patterns" or "detect events" in sequential state data (positions, velocities, contacts, statuses over time)
- When creating a domain-specific language (DSL) for composing temporal/logical queries over event traces
- When raw trace data is too large or too granular for direct LM context and needs coarse-grained abstraction
Key Technique
The scalability problem. Feeding raw simulation traces directly to an LM fails because traces contain thousands of timesteps of numerical state (positions, velocities, contacts per object). This exceeds context limits and overwhelms the LM's ability to reason about physics. The paper's insight is to insert an intermediate representation: a pattern annotation matrix where each row is a timestep and each column is a named high-level pattern (e.g., "sliding_contact", "lever_launch", "global_rest"), with boolean or continuous activation values.
Program synthesis for pattern detection. Rather than hand-coding detectors, the method uses FunSearch-style evolutionary program synthesis. An LM proposes candidate Python functions that read trace data and return activation signals. These candidates are scored on a fitness function combining: (1) correlation between state-space distances and annotation distances across trajectories, (2) novelty relative to existing detectors, and (3) penalties for excessive length or computation time. Candidates are iteratively mutated, evaluated, and refined. Natural language descriptions from domain experts ("a lever launches a ball") seed the initial candidates, and additional patterns are self-discovered by analyzing LM reasoning traces from Q&A tasks.