How facebookresearch/simuleval works
1. What this repository is
SimulEval is a Python package for evaluating simultaneous translation systems, especially text-to-text, speech-to-text, and speech-to-speech setups. Its core role is not training models, but driving incremental evaluation of an agent against source/target data and computing latency/quality metrics.
2. Top-level execution path
The main entry point is the simuleval CLI (simuleval/cli.py), configured by simuleval/options.py. A typical run reads source data, loads an agent, runs an evaluation loop, and produces scores and optional visualizations.
3. Agent boundary
The simuleval/agents package defines the contract for systems under test:
- agent.py defines the base agent interface.
- states.py and actions.py model the agent’s incremental state and decisions.
- pipeline.py supports pipeline-style agents.
- service.py suggests a service/remote-agent mode.
This is the key boundary between the framework and the translation/speech model being evaluated.
4. Input data layer
simuleval/data contains the abstractions for feeding evaluation instances:
- dataloader/ provides loaders for different modalities, including text-to-text and speech-to-text.
- segments.py represents source/target segments and incremental chunks.
The data layer converts files like source.txt, target.txt, and audio inputs into a stream the evaluator can consume step by step.
5. Evaluation engine
The core runtime lives in simuleval/evaluator:
- evaluator.py coordinates the evaluation loop.
- instance.py represents a single evaluated sample/stream.
- remote.py supports distributed or remote execution.
This layer orchestrates the interaction between dataloader, agent, and scorers, maintaining the simultaneous setting where source arrives gradually and outputs are produced incrementally.
6. Metrics and scoring
simuleval/evaluator/scorers separates metric computation from the run loop:
- quality_scorer.py handles translation/output quality.
- latency_scorer.py handles delay/latency metrics.
This separation matters architecturally because the evaluator produces behavior traces, and scorers turn those traces into the final assessment.
7. Analysis and visualization
simuleval/analysis/curve.py and simuleval/utils/visualize.py indicate post-evaluation analysis, likely for plotting latency-quality tradeoffs or policy curves. This is a downstream layer: it consumes evaluation outputs rather than participating in the online decision loop.
8. Utilities and environment helpers
simuleval/utils contains supporting infrastructure:
- arguments.py and functional.py for shared plumbing.
- agent.py for agent-related helpers.
- slurm.py for batch/HPC execution support.
These are cross-cutting utilities rather than core domain logic.
9. Examples as architecture documentation
The examples/ tree is substantial and shows intended usage patterns:
- quick_start/ demonstrates a minimal wait-k style agent and CLI invocation.
- speech_to_text/ and speech_to_speech/ show modality-specific evaluation.
- *_demo/ and speech_to_speech_text/ show pipeline-based variants.
The examples reveal that the framework is designed around pluggable agents rather than a fixed model architecture.
10. Tests define the supported contracts
The test suite in simuleval/test covers agent behavior, pipeline integration, evaluator behavior, remote evaluation, speech-to-text, speech-to-speech, and visualization. This suggests the most important system boundaries are:
- agent API compatibility,
- evaluator/instance orchestration,
- modality-specific dataloading,
- scoring correctness,
- remote execution behavior.
11. Documentation and release pipeline
docs/ contains user guides and tutorials for agents, dataloaders, evaluators, and remote evaluation, while GitHub Actions workflows handle CI and PyPI publishing. These are operationally important but sit outside the runtime architecture.
12. Overall data flow
In diagram form, the main flow is:
source/target inputs or audio → dataloader/segments → evaluator/instance loop → agent state/actions → incremental outputs → quality + latency scorers → reports/visualization.
The main architectural boundary is between the framework and the user-provided agent, with modality-specific dataloaders and scorers adapting the same evaluation engine to text and speech tasks.
Main entry points: evaluator.py Evaluator · agent.py Agent base · dataloader.py Data loader · curve.py Curves
Components 21
Core runtime
CLI, options, evaluation loop, scoring, and remote execution.
- CLI · Command-line entrypoint for running evaluations.
simuleval/cli.py - Options · Parses and normalizes runtime settings for the CLI.
simuleval/options.py - Evaluator · Main loop that drives incremental evaluation.
simuleval/evaluator/evaluator.py - Instance · Represents one evaluated sample or stream.
simuleval/evaluator/instance.py - Remote exec · Supports remote or distributed evaluation execution.
simuleval/evaluator/remote.py - Quality scorer · Computes output quality metrics.
simuleval/evaluator/scorers/quality_scorer.py - Latency scorer · Computes delay and latency metrics.
simuleval/evaluator/scorers/latency_scorer.py
Agent contracts
Framework interfaces and agent-side runtime abstractions.
- Agent base · Base contract for user-provided agents.
simuleval/agents/agent.py - States · Incremental state tracked by an agent.
simuleval/agents/states.py - Actions · Agent decisions in the incremental loop.
simuleval/agents/actions.py - Pipeline agent · Pipeline-style agent composition support.
simuleval/agents/pipeline.py - Service agent · Remote or service-based agent mode.
simuleval/agents/service.py
Input data
Dataloaders and segment representations for incremental evaluation.
- Data loader · Common loader interface for evaluation inputs.
simuleval/data/dataloader/dataloader.py - Text loader · Loads text-to-text evaluation streams.
simuleval/data/dataloader/t2t_dataloader.py - Speech loader · Loads speech-to-text evaluation streams.
simuleval/data/dataloader/s2t_dataloader.py - Segments · Source and target segment abstractions for incremental feeding.
simuleval/data/segments.py
Post-run analysis
Visualization and curve analysis after evaluation completes.
Examples
Representative usage patterns for text and speech evaluation.
- Quick start · Minimal agent and CLI examples for text evaluation.
examples/quick_start - Speech-to-text · Speech-to-text evaluation examples and demos.
examples/speech_to_text - Speech-to-speech · Speech-to-speech evaluation examples and demos.
examples/speech_to_speech
Connections 21
- CLI → Options: reads · CLI uses parsed options to configure a run.
- CLI → Evaluator: starts · CLI launches the evaluation engine.
- Evaluator → Data loader: consumes · Evaluation is driven by input streams from loaders.
- Data loader → Text loader: specializes · Text-to-text loader is one modality implementation.
- Data loader → Speech loader: specializes · Speech-to-text loader is one modality implementation.
- Data loader → Segments: emits · Loaders produce incremental segments.
- Evaluator → Instance: manages · The evaluator tracks one or more instances.
- Instance → Agent base: invokes · Each instance queries the evaluated agent.
- Agent base → States: uses · Agents maintain incremental state.
- Agent base → Actions: returns · Agents produce incremental actions or decisions.
- Agent base → Pipeline agent: extends · Pipeline agents implement the base contract.
- Agent base → Service agent: extends · Service agents implement the base contract.
- Evaluator → Remote exec: optionally delegates · Evaluation can run through a remote execution layer.
- Evaluator → Quality scorer: scores · Quality metrics are computed from evaluation traces.
- Evaluator → Latency scorer: scores · Latency metrics are computed from evaluation traces.
- Quality scorer → Curves: feeds · Quality results can be analyzed as curves.
- Latency scorer → Curves: feeds · Latency results can be analyzed as curves.
- Curves → Visualize: renders · Analysis outputs are visualized downstream.
- Quick start → Agent base: demonstrates · Shows minimal agent implementations.
- Speech-to-text → Speech loader: demonstrates · Shows speech-to-text data and agent setup.
- Speech-to-speech → Service agent: demonstrates · Shows speech-to-speech and pipeline variants.