Spaces:
Sleeping
Sleeping
File size: 7,745 Bytes
d3d0e0e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | # Phase 15: Run + Evaluation Workflow
## Overview
Phase 15 adds explicit support for running evaluation (eval-v2) alongside task execution in the Data Agent Observatory. This enables a streamlined workflow where users can optionally evaluate runs immediately after execution, or manually trigger evaluation from the Run Intelligence page.
## Key Capabilities
### 1. Run Only (Default)
Execute selected tasks without evaluation. This remains the default behavior.
### 2. Run + Eval-v2 (Optional)
When `gold_root` is configured and the user checks "Run eval-v2 after execution", the system will:
- Execute the selected tasks
- Automatically run eval-v2 if:
- Run completed successfully
- `gold_root` exists
- Evaluation is enabled in config
### 3. Load Existing Eval-v2 Artifacts
Run Intelligence page continues to load and display existing evaluation artifacts.
### 4. Explicit Evaluation Trigger
When eval artifacts are missing and `gold_root` is available, Run Intelligence shows a "Run Evaluation Now" button.
## Architecture
```
Streamlit UI → Application Services → Existing eval-v2 Engine
```
### Hard Boundaries (Preserved)
- No subprocess calls
- No CLI invocation from Streamlit
- No duplicate evaluator implementation
- No duplicate execution loop
- No automatic evaluation on page load
- No mutation of trace.json or prediction.csv
- No new metric formulas
### Service Layers
1. **EvaluationService**: Added `evaluate_run_if_configured()` method
2. **Service Adapters**: Added `execute_with_optional_evaluation()` orchestration
3. **UI Pages**: Updated to expose evaluation controls
## Configuration
Add an `evaluation` section to your config YAML:
```yaml
evaluation:
enabled: true
gold_root: /data3/dataFAIR/kdd-dev/public/output
run_after_execution: false
fail_if_ground_truth_missing: false
lambda_penalty: 0.1
mode: standard # standard | verbose | research
```
### Configuration Fields
- **enabled**: Enable evaluation support (default: false)
- **gold_root**: Path to ground truth data directory (default: None)
- **run_after_execution**: Auto-run eval after execution (default: false)
- **fail_if_ground_truth_missing**: Raise error if gold_root missing (default: false)
- **lambda_penalty**: Penalty for eval-v2 scoring (default: 0.1)
- **mode**: Evaluation mode (default: "standard")
## User Workflows
### Workflow 1: Run Only
1. Select tasks in Run Launcher
2. Leave "Run eval-v2 after execution" unchecked
3. Click "Start Run"
4. Review run artifacts
### Workflow 2: Run + Evaluate
1. Configure `evaluation.gold_root` in config
2. Select tasks in Run Launcher
3. Check "Run eval-v2 after execution"
4. Click "Start Run"
5. System executes tasks and then runs evaluation
6. Review both run and evaluation artifacts
### Workflow 3: Manual Evaluation Trigger
1. Open Run Intelligence for a completed run
2. If eval artifacts missing and `gold_root` configured:
- Click "Run Evaluation Now"
- Wait for evaluation to complete
- Page automatically refreshes
## UI Changes
### Run Launcher Page
Added **Evaluation** section showing:
- Ground truth configuration status
- Gold root path (if configured)
- Evaluation mode and lambda penalty
- Checkbox: "Run eval-v2 after execution"
- Disabled if gold_root not configured or not found
- Default value from `config.evaluation.run_after_execution`
### Run Intelligence Page
When eval artifacts missing:
- Shows "Evaluation Artifacts Missing" warning
- Shows eval command guidance: `dabench eval-v2 <run_id>`
- Shows a "Run Evaluation" button
- Button runs `dabench eval-v2 <run_id>` and auto-refreshes on success
- `View level` selector is hidden in missing-evaluation state and appears only after evaluation artifacts are available
### Demo Page
Added read-only evaluation status badge:
- ✅ Evaluated
- ⚠️ Not evaluated
- ❓ Evaluation unavailable
## Artifact Layout
Phase 15 preserves the current root-level eval-v2 artifact layout:
```
run_dir/
task_metrics.csv
trajectory.csv
tool_calls.csv
comprehensive_evaluation.csv
validation_report.md
auditor_validation_report.md
artifact_reconciliation_report.txt
engineering_health_report.txt
```
**No migration to `evaluation/` folder in Phase 15.** This is deferred to Phase 17.
## Failure Handling
### Custom Tasks Without Gold
- Evaluation checkbox disabled
- Status: "Evaluation unavailable"
- Not treated as an error
### Missing Gold Root
- **Graceful skip** (default): Evaluation returns None
- **Strict mode** (`fail_if_ground_truth_missing=true`): Raises FileNotFoundError
### Run Failed
- Evaluation automatically skipped
- No error raised
## Evaluation States
User-facing states displayed in UI:
- **Evaluation ready**: Config valid, gold_root exists
- **Evaluation unavailable**: No gold_root or missing
- **Evaluation exists**: Artifacts already present
- **Evaluation running**: In progress (with spinner)
- **Evaluation completed**: Success
- **Evaluation failed**: Error occurred
- **Evaluation skipped**: Conditions not met
## Implementation Details
### Config Schema
Added `EvaluationConfig` dataclass:
```python
@dataclass(frozen=True, slots=True)
class EvaluationConfig:
enabled: bool = False
gold_root: Path | None = None
run_after_execution: bool = False
fail_if_ground_truth_missing: bool = False
lambda_penalty: float = 0.1
mode: str = "standard"
```
### Service Method
Added to `EvaluationService`:
```python
def evaluate_run_if_configured(
self,
run_result: RunExecutionResult,
eval_config: EvaluationConfig,
*,
progress_callback: ProgressCallback | None = None,
) -> EvaluationBundle | None:
...
```
### Orchestration
Added to `service_adapters.py`:
```python
def execute_with_optional_evaluation(
run_service: RunExecutionService,
eval_service: EvaluationService,
spec: RunSpec,
eval_config: EvaluationConfig,
...
) -> tuple[RunExecutionResult, EvaluationBundle | None]:
...
```
## Testing
### Unit Tests
- `tests/unit/test_config.py`: Config schema and parsing
- `tests/unit/application/test_evaluation_service.py`: Conditional evaluation logic
- `tests/unit/observatory/test_service_adapters_phase15.py`: Orchestration
### Integration Tests
- `tests/integration/test_phase15_run_evaluation_workflow.py`: End-to-end workflow
### UI Tests
- `tests/test_observatory_run_launcher_page.py`: Run Launcher evaluation controls
- `tests/test_observatory_run_intelligence_page.py`: Manual evaluation trigger
- `tests/test_observatory_demo_page.py`: Evaluation status badge
## Known Limitations
1. **No background evaluation**: Evaluation runs synchronously during execution
2. **No evaluation progress UI**: Progress callbacks not yet wired to UI
3. **No evaluation retry**: Failed evaluations require manual re-trigger
4. **No canonical evaluation/ folder**: Deferred to Phase 17
5. **Custom tasks**: Evaluation unavailable (by design)
## Safety
Phase 15 maintains architectural boundaries:
- ✅ No subprocess/CLI from Streamlit
- ✅ No duplicate eval-v2 implementation
- ✅ No mutation of existing artifacts
- ✅ No automatic evaluation on page load
- ✅ Service layer properly isolated
## Migration Path
Existing configs without `evaluation` section:
- Work without modification
- Evaluation disabled by default
- No breaking changes
To enable evaluation:
1. Add `evaluation` section to config
2. Set `enabled: true` and configure `gold_root`
3. Optionally set `run_after_execution: true` for auto-eval
## Future Work (Phase 17+)
- Migrate to canonical `evaluation/` folder structure
- Add evaluation progress UI
- Support background/async evaluation
- Add evaluation retry mechanism
- Support custom gold data for custom tasks
|