|
| 1 | +# CONVERSE Benchmark |
| 2 | + |
| 3 | +CONVERSE evaluates privacy and security robustness in agent-to-agent conversations where the external counterpart is adversarial. |
| 4 | + |
| 5 | +## What It Tests |
| 6 | + |
| 7 | +- Privacy attacks: the external agent tries to extract sensitive profile details. |
| 8 | +- Security attacks: the external agent tries to induce unauthorized tool actions. |
| 9 | +- Multi-turn manipulation: attacks progress over several conversational turns. |
| 10 | + |
| 11 | +## Data Source |
| 12 | + |
| 13 | +Data is loaded from [the official CONVERSE repository `amrgomaaelhady/ConVerse`](https://github.com/amrgomaaelhady/ConVerse) |
| 14 | + |
| 15 | +Supported domains: |
| 16 | + |
| 17 | +- `travel` |
| 18 | +- `real_estate` |
| 19 | +- `insurance` |
| 20 | + |
| 21 | +## Usage |
| 22 | + |
| 23 | +Implement a framework-specific subclass of `ConverseBenchmark` and provide agent setup plus model adapter provisioning. |
| 24 | + |
| 25 | +```python |
| 26 | +from typing import Any, Dict, Optional, Sequence, Tuple |
| 27 | + |
| 28 | +from maseval import AgentAdapter, Environment, ModelAdapter, Task, User |
| 29 | +from maseval.benchmark.converse import ConverseBenchmark, ensure_data_exists, load_tasks |
| 30 | +from maseval.core.seeding import SeedGenerator |
| 31 | + |
| 32 | + |
| 33 | +class MyConverseBenchmark(ConverseBenchmark): |
| 34 | + def setup_agents( |
| 35 | + self, |
| 36 | + agent_data: Dict[str, Any], |
| 37 | + environment: Environment, |
| 38 | + task: Task, |
| 39 | + user: Optional[User], |
| 40 | + seed_generator: SeedGenerator, |
| 41 | + ) -> Tuple[Sequence[AgentAdapter], Dict[str, AgentAdapter]]: |
| 42 | + # Create your framework agent(s) using environment tools. |
| 43 | + ... |
| 44 | + |
| 45 | + def get_model_adapter(self, model_id: str, **kwargs: Any) -> ModelAdapter: |
| 46 | + # Create and optionally register model adapter. |
| 47 | + ... |
| 48 | + |
| 49 | + |
| 50 | +# First call downloads source files to the local benchmark data cache. |
| 51 | +ensure_data_exists(domain="travel") |
| 52 | +tasks = load_tasks(domain="travel", split="privacy", limit=5) |
| 53 | + |
| 54 | +benchmark = MyConverseBenchmark(progress_bar=False) |
| 55 | +results = benchmark.run( |
| 56 | + tasks=tasks, |
| 57 | + agent_data={ |
| 58 | + "model_id": "gpt-4o-mini", |
| 59 | + "attacker_model_id": "gpt-4o", |
| 60 | + "max_turns": 10, |
| 61 | + }, |
| 62 | +) |
| 63 | +``` |
| 64 | + |
| 65 | +## Default Implementation |
| 66 | + |
| 67 | +CONVERSE also provides a built-in default agent loop via `DefaultAgentConverseBenchmark`. |
| 68 | +You only need to supply `get_model_adapter()`. |
| 69 | + |
| 70 | +```python |
| 71 | +from typing import Any |
| 72 | + |
| 73 | +from maseval import ModelAdapter |
| 74 | +from maseval.benchmark.converse import DefaultAgentConverseBenchmark, load_tasks |
| 75 | +from maseval.interface.inference import OpenAIModelAdapter |
| 76 | + |
| 77 | + |
| 78 | +class MyDefaultConverseBenchmark(DefaultAgentConverseBenchmark): |
| 79 | + def get_model_adapter(self, model_id: str, **kwargs: Any) -> ModelAdapter: |
| 80 | + adapter = OpenAIModelAdapter(client=..., model_id=model_id, seed=kwargs.get("seed")) |
| 81 | + if kwargs.get("register_name"): |
| 82 | + self.register(kwargs.get("register_category", "models"), kwargs["register_name"], adapter) |
| 83 | + return adapter |
| 84 | + |
| 85 | + |
| 86 | +tasks = load_tasks(domain="travel", split="privacy", limit=5) |
| 87 | +benchmark = MyDefaultConverseBenchmark(progress_bar=False) |
| 88 | +results = benchmark.run( |
| 89 | + tasks=tasks, |
| 90 | + agent_data={ |
| 91 | + "model_id": "gpt-4o-mini", |
| 92 | + "attacker_model_id": "gpt-4o", |
| 93 | + }, |
| 94 | +) |
| 95 | +``` |
| 96 | + |
| 97 | +For a full runnable example script, see: |
| 98 | + |
| 99 | +- `examples/converse_benchmark/default_converse_benchmark.py` |
| 100 | + |
| 101 | +## Evaluation Output |
| 102 | + |
| 103 | +Privacy evaluator output fields: |
| 104 | + |
| 105 | +- `privacy_leak` |
| 106 | +- `score` |
| 107 | +- `leak_turn` |
| 108 | +- `matched_snippet` |
| 109 | + |
| 110 | +Security evaluator output fields: |
| 111 | + |
| 112 | +- `security_violation` |
| 113 | +- `score` |
| 114 | +- `violated_tools` |
| 115 | + |
| 116 | +[:material-github: View source](https://github.com/parameterlab/MASEval/blob/main/maseval/benchmark/converse/converse.py){ .md-source-file } |
| 117 | + |
| 118 | +::: maseval.benchmark.converse.ConverseBenchmark |
| 119 | + |
| 120 | +::: maseval.benchmark.converse.DefaultAgentConverseBenchmark |
| 121 | + |
| 122 | +::: maseval.benchmark.converse.DefaultConverseAgent |
| 123 | + |
| 124 | +::: maseval.benchmark.converse.DefaultConverseAgentAdapter |
| 125 | + |
| 126 | +::: maseval.benchmark.converse.ConverseEnvironment |
| 127 | + |
| 128 | +::: maseval.benchmark.converse.ConverseExternalAgent |
| 129 | + |
| 130 | +::: maseval.benchmark.converse.PrivacyEvaluator |
| 131 | + |
| 132 | +::: maseval.benchmark.converse.SecurityEvaluator |
| 133 | + |
| 134 | +::: maseval.benchmark.converse.load_tasks |
| 135 | + |
| 136 | +::: maseval.benchmark.converse.ensure_data_exists |
0 commit comments