File size: 3,321 Bytes
8c10cf2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# SQLAssistant-A2A Evaluation Scripts

This directory contains evaluation scripts for analyzing the SQLAssistant-A2A project results across different language models.

## Scripts

### 1. analyze_retry_patterns.py
Analyzes RETRY patterns in execution paths, including:
- **Orchestrator RETRY**: Framework-level retries (e.g., `crew_execution (retry N)`)
- **Business RETRY**: Application-level retries (e.g., `generate_sql (business_retry N)`)

**Output Files:**
- `retry_analysis.json` - Detailed retry statistics
- `retry_summary.csv` - Summary statistics by model
- `error_by_agent.csv` - Error location statistics by agent
- `business_retry_chapters.csv` - Business retry location statistics

**Usage:**
```bash
python3 analyze_retry_patterns.py
```

### 2. evaluate_scores.py
Collects and analyzes score statistics from execution logs.

**Output Files:**
- `score_analysis.json` - Detailed score data
- `score_summary.csv` - Summary statistics by model

**Usage:**
```bash
python3 evaluate_scores.py
```

### 3. evaluate_success.py
Calculates success rates based on whether required tools were executed.

**Success Criteria:** Execution of `get_database_schema` tool (required to understand database structure)

**Output Files:**
- `success_detailed_results.json` - Detailed results by session
- `success_rate.csv` - Success rate summary by model

**Usage:**
```bash
python3 evaluate_success.py
```

### 4. evaluate_trajectory-Filter_Tools.py
Evaluates execution trajectories using 6 metrics:
1. **Exact match** - Complete trajectory match
2. **In-order match** - Required steps appear in order
3. **Any-order match** - All required steps present
4. **Precision** - Correctness of predicted steps
5. **Recall** - Coverage of required steps
6. **Single-tool use** - Individual tool usage rates

**Configuration:**
- Uses `reference_trajectory.yaml` for ground truth trajectory definition

**Output Files:**
- `evaluation_results.csv` - Evaluation metrics by model
- `evaluation_results.md` - Formatted results report
- `any_order_match_failures.csv` - Failure analysis (with `--diagnose-failures`)

**Usage:**
```bash
python3 evaluate_trajectory-Filter_Tools.py --config reference_trajectory.yaml
python3 evaluate_trajectory-Filter_Tools.py --diagnose-failures  # With failure analysis
```

## Configuration

### reference_trajectory.yaml
Defines the ground truth execution trajectory for the SQLAssistant-A2A project, including:
- Reference trajectory steps
- Target tools for evaluation
- Model list
- Extract types (SPAN, Chain, Agent, LLM, Tool)

## Models Evaluated

- DeepSeek-R1
- DeepSeek-V3-1
- GPT-4o-mini
- GPT-5
- Gemini-2.5-flash
- Gemini-2.5-flash-nothinking
- Qwen3-235b

## Data Structure

Scripts expect the following directory structure:
```
/Users/wzr/TOSEM-2025/RESULTS/
├── <model_name>/
│   └── SQLAssistant-A2A/
│       └── test_results/
│           ├── session_1/
│           │   ├── execution_path.md
│           │   └── execution_log.json
│           ├── session_2/
│           └── ...
```

## Requirements

- Python 3.x
- pandas
- PyYAML

## Notes

- All scripts automatically process all configured models
- Results are saved in the same directory as the scripts
- Scripts handle missing data gracefully and report warnings