AIPerf Plugin System
The AIPerf plugin system provides a flexible, extensible architecture for customizing benchmark behavior. It uses YAML-based configuration with lazy loading, priority-based conflict resolution, and dynamic enum generation.
Table of Contents
- Overview
- Architecture
- Plugin Categories
- Using Plugins
- Creating Custom Plugins
- Plugin Configuration
- CLI Commands
- Advanced Topics
Overview
The plugin system enables:
- Extensibility: Add custom endpoints, exporters, and timing strategies without modifying core code
- Lazy Loading: Classes load on first access, avoiding circular imports
- Conflict Resolution: Higher priority plugins override lower priority ones
- Type Safety: Auto-generated enums provide IDE autocomplete
- Validation: Validate plugins without importing them
Terminology
Hierarchy:
Key Components
Architecture
Discovery Flow
Registry Singleton Pattern
The plugin registry follows the singleton pattern with module-level exports:
Plugin Categories
AIPerf supports 25 plugin categories organized by function:
Timing Categories
Dataset Categories
Endpoint and Transport Categories
Processing Categories
Accuracy Categories
UI and Selection Categories
Service Categories
Visualization and Telemetry Categories
Infrastructure Categories (Internal)
Using Plugins
Creating Custom Plugins
Contributing directly to AIPerf? You only need two things:
- Add your class under
src/aiperf/ - Register it in
src/aiperf/plugin/plugins.yaml
The pyproject.toml entry points and separate package install below are only needed for external/third-party plugins.
Quick Start (4 steps):
Minimal Endpoint Example
Extend base classes (BaseEndpoint, etc.) to get logging, helpers, and default implementations. Only implement core methods.
Plugin Configuration
categories.yaml Schema
Defines plugin categories with their protocols and metadata schemas:
plugins.yaml Schema
Registers plugin implementations:
Metadata Schemas
Category-specific metadata is validated against Pydantic models in aiperf.plugin.schema.schemas:
CLI Commands
Advanced Topics
Conflict Resolution
Shadowed plugins remain accessible via full class path: plugins.get_class("endpoint", "my_pkg.endpoints:MyEndpoint")
API Reference
Type Safety:
get_class()returns typed results (e.g.,type[EndpointProtocol]) with IDE autocomplete.
Built-in Plugins Reference
Endpoints
Timing Strategies
Arrival Patterns
Dataset Composers
UI Types
Accuracy Benchmarks
Accuracy Graders
Troubleshooting
Plugin Not Found
Solutions:
- Verify the plugin is registered in
plugins.yaml - Check the entry point is defined in
pyproject.toml - Reinstall the package:
pip install -e . - Run
aiperf plugins --validateto check for errors
Module Import Errors
Solutions:
- Verify the class path format:
module.path:ClassName - Check all dependencies are installed
- Verify the module is importable:
python -c "import module.path"
Class Not Found
Solutions:
- Verify the class name matches exactly (case-sensitive)
- Ensure the class is exported from the module
- Run
aiperf plugins --validatefor detailed error
Conflict Resolution Issues
If your plugin is being shadowed by another:
- Use higher priority:
priority: 10inplugins.yaml - Access by full class path:
plugins.get_class("endpoint", "my_pkg.endpoints:MyEndpoint") - Check
aiperf pluginsto see which packages are loaded