File size: 4,290 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 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 | # RecruitmentAssistant-H_A2A Evaluation Scripts
This directory contains evaluation scripts for analyzing the RecruitmentAssistant-H_A2A (Hybrid A2A) project results.
## Architecture
This project uses a hybrid Agent-to-Agent (A2A) architecture:
- **LangGraph** - Job Analysis stage with dynamic batched tool execution
- **CrewAI** - Candidate Evaluation stage with standard CrewAI structure
- **AutoGen** - Interview Communication stage with flexible LLM/tool patterns
## Scripts
### 1. analyze_retry_patterns.py
Analyzes RETRY patterns in execution paths.
**Features:**
- Counts error occurrences by location and type
- Calculates RETRY rates per model
- Identifies maximum RETRY attempts
- Tracks errors by agent and node type
**Output:**
- `retry_analysis.json` - Detailed JSON results
- `retry_summary.csv` - Summary statistics
- `error_by_agent.csv` - Error breakdown by agent
**Usage:**
```bash
python3 analyze_retry_patterns.py
```
### 2. evaluate_success.py
Calculates success rates for each model.
**Success Criteria:**
- Reports folder exists
- Contains at least 2 markdown files
**Output:**
- `success_detailed_results.json` - Detailed results per session
- `success_rate.csv` - Success rate summary
**Usage:**
```bash
python3 evaluate_success.py
```
### 3. evaluate_trajectory-mix.py
Evaluates trajectory metrics with hybrid architecture support.
**Special Features:**
- **Dynamic LangGraph matching** - Handles batched tool execution patterns (3-4 searches)
- **AutoGen LLM insertion** - Flexible LLM call patterns between tools
- **Tool order permutation** - Evaluates different tool call orders
**Metrics:**
- Exact match
- In-order match
- Any-order match
- Precision
- Recall
- Single-tool use
- Path diversity (unique path ratio, path entropy)
**Output:**
- `evaluation_results.csv` - Trajectory evaluation results
**Usage:**
```bash
python3 evaluate_trajectory-mix.py --config reference_trajectory.yaml
```
### 4. reference_trajectory.yaml
Configuration file defining reference trajectories and evaluation parameters.
**Key Sections:**
- `reference_trajectory_3x` - Reference for 3 web searches
- `reference_trajectory_4x` - Reference for 4 web searches
- `target_tools` - Required tools for evaluation
- `models` - List of models to evaluate
- `permutable_tool_groups` - Tool groups that can appear in any order
- `extract_types` - Node types to extract (SPAN, Chain, AGENT, LLM, Tool)
## Dynamic Matching
The hybrid architecture requires sophisticated matching:
### Layer 1: LangGraph Tools Batching
- 3 searches: 4 grouping patterns `[1,1,1]`, `[1,2]`, `[2,1]`, `[3]`
- 4 searches: 7 grouping patterns `[1,1,1,1]`, `[2,1,1]`, `[1,2,1]`, `[1,1,2]`, `[3,1]`, `[1,3]`, `[4]`
### Layer 2: AutoGen LLM Insertion
- 2 tools: 2 patterns (0 or 1 LLM between tools)
- 3 tools: 4 patterns (2^2 combinations)
### Layer 3: Tool Order Permutation
- Candidate evaluation tools can appear in any order
- Interview communication tools can appear in any order
**Total combinations:** Up to 7 × 2 × (permutations) variants per sample
## Configuration
Edit `reference_trajectory.yaml` to:
- Modify reference trajectories
- Add/remove models
- Adjust tool evaluation criteria
- Configure dynamic matching patterns
- Enable/disable pattern matching layers
## Requirements
- Python 3.7+
- pandas
- pyyaml
Install dependencies:
```bash
pip install pandas pyyaml
```
## Data Structure
Expected directory structure:
```
/Users/wzr/TOSEM-2025/RESULTS/
├── ModelName/
│ └── RecruitmentAssistant-H_A2A/
│ └── test_results/
│ ├── session_1/
│ │ ├── execution_path.md
│ │ └── reports/
│ │ ├── file1.md
│ │ └── file2.md
│ └── session_2/
│ └── ...
```
## Notes
- The hybrid architecture requires more flexible matching than standard frameworks
- Dynamic reference selection adapts to different model execution strategies
- All scripts output CSV files for easy analysis
- JSON files contain detailed per-session information
- Modify `BASE_DIR` in scripts if using a different results directory
- The evaluation automatically selects the best-matching reference variant per sample
|