From 017e418fc0104e2c4d359d6e0a410d08af216315 Mon Sep 17 00:00:00 2001 From: N!no Date: Tue, 7 Jul 2026 21:27:23 -0400 Subject: [PATCH 1/6] fix: attn implementation --- multiturn_flat/baseline/single_agent/config.yaml | 1 + multiturn_flat/baseline/single_agent/eval_single_agent.py | 2 ++ multiturn_flat/config.py | 2 ++ multiturn_flat/configs/multiturn_flat_magrpo_config.yaml | 1 + multiturn_flat/train/train_magrpo.py | 1 + native_parallel/baseline/single_agent/config.yaml | 1 + native_parallel/baseline/single_agent/eval_single_agent.py | 2 ++ native_parallel/config.py | 2 ++ native_parallel/configs/native_parallel_magrpo_config.yaml | 1 + native_parallel/train/train_magrpo.py | 1 + 10 files changed, 14 insertions(+) diff --git a/multiturn_flat/baseline/single_agent/config.yaml b/multiturn_flat/baseline/single_agent/config.yaml index d335da2..0f71b2f 100644 --- a/multiturn_flat/baseline/single_agent/config.yaml +++ b/multiturn_flat/baseline/single_agent/config.yaml @@ -7,6 +7,7 @@ agent_model: max_length: 4096 special_tokens: {} torch_dtype: null + attn_implementation: eager dataset: name: OpenMLRL/BFCL-V4-Parallel-Multi-Turn diff --git a/multiturn_flat/baseline/single_agent/eval_single_agent.py b/multiturn_flat/baseline/single_agent/eval_single_agent.py index 780fc77..84e9efd 100644 --- a/multiturn_flat/baseline/single_agent/eval_single_agent.py +++ b/multiturn_flat/baseline/single_agent/eval_single_agent.py @@ -262,6 +262,8 @@ def main() -> None: dtype = _torch_dtype(model_config.torch_dtype) if dtype is not None: model_kwargs["torch_dtype"] = dtype + if model_config.attn_implementation is not None: + model_kwargs["attn_implementation"] = model_config.attn_implementation model = AutoModelForCausalLM.from_pretrained(model_config.name, **model_kwargs).to(device) model.eval() diff --git a/multiturn_flat/config.py b/multiturn_flat/config.py index 78da109..214e6d8 100644 --- a/multiturn_flat/config.py +++ b/multiturn_flat/config.py @@ -20,6 +20,7 @@ class ModelConfig: max_length: int = 4096 special_tokens: Dict[str, str] = field(default_factory=dict) torch_dtype: Optional[str] = None + attn_implementation: Optional[str] = "sdpa" @classmethod def from_dict( @@ -72,6 +73,7 @@ def _as_optional_int(value: Any) -> Optional[int]: max_length=config_dict.get("max_length", 4096), special_tokens=config_dict.get("special_tokens", {}), torch_dtype=(config_dict.get("torch_dtype") or config_dict.get("dtype")), + attn_implementation=config_dict.get("attn_implementation", "sdpa"), ) diff --git a/multiturn_flat/configs/multiturn_flat_magrpo_config.yaml b/multiturn_flat/configs/multiturn_flat_magrpo_config.yaml index 31a981d..149b617 100644 --- a/multiturn_flat/configs/multiturn_flat_magrpo_config.yaml +++ b/multiturn_flat/configs/multiturn_flat_magrpo_config.yaml @@ -7,6 +7,7 @@ agent_model: max_length: 4096 special_tokens: {} torch_dtype: null + attn_implementation: eager agents: null diff --git a/multiturn_flat/train/train_magrpo.py b/multiturn_flat/train/train_magrpo.py index af4e367..10b345c 100644 --- a/multiturn_flat/train/train_magrpo.py +++ b/multiturn_flat/train/train_magrpo.py @@ -239,6 +239,7 @@ def main() -> None: tokenizer=tokenizers if agent_names else tokenizers[0], model_config={ "torch_dtype": model_config.torch_dtype, + "attn_implementation": model_config.attn_implementation, "special_tokens": model_config.special_tokens, }, train_dataset=train_dataset, diff --git a/native_parallel/baseline/single_agent/config.yaml b/native_parallel/baseline/single_agent/config.yaml index 6a78a33..e39f8b6 100644 --- a/native_parallel/baseline/single_agent/config.yaml +++ b/native_parallel/baseline/single_agent/config.yaml @@ -7,6 +7,7 @@ agent_model: max_length: 4096 special_tokens: {} torch_dtype: null + attn_implementation: eager dataset: name: OpenMLRL/BFCL-V4-Parallel-Native diff --git a/native_parallel/baseline/single_agent/eval_single_agent.py b/native_parallel/baseline/single_agent/eval_single_agent.py index 710dfe6..81676cf 100644 --- a/native_parallel/baseline/single_agent/eval_single_agent.py +++ b/native_parallel/baseline/single_agent/eval_single_agent.py @@ -242,6 +242,8 @@ def main() -> None: dtype = _torch_dtype(model_config.torch_dtype) if dtype is not None: model_kwargs["torch_dtype"] = dtype + if model_config.attn_implementation is not None: + model_kwargs["attn_implementation"] = model_config.attn_implementation model = AutoModelForCausalLM.from_pretrained(model_config.name, **model_kwargs).to(device) model.eval() diff --git a/native_parallel/config.py b/native_parallel/config.py index 7526031..19cc749 100644 --- a/native_parallel/config.py +++ b/native_parallel/config.py @@ -20,6 +20,7 @@ class ModelConfig: max_length: int = 4096 special_tokens: Dict[str, str] = field(default_factory=dict) torch_dtype: Optional[str] = None + attn_implementation: Optional[str] = "sdpa" @classmethod def from_dict( @@ -72,6 +73,7 @@ def _as_optional_int(value: Any) -> Optional[int]: max_length=config_dict.get("max_length", 4096), special_tokens=config_dict.get("special_tokens", {}), torch_dtype=(config_dict.get("torch_dtype") or config_dict.get("dtype")), + attn_implementation=config_dict.get("attn_implementation", "sdpa"), ) diff --git a/native_parallel/configs/native_parallel_magrpo_config.yaml b/native_parallel/configs/native_parallel_magrpo_config.yaml index f19123e..2fad7e3 100644 --- a/native_parallel/configs/native_parallel_magrpo_config.yaml +++ b/native_parallel/configs/native_parallel_magrpo_config.yaml @@ -7,6 +7,7 @@ agent_model: max_length: 4096 special_tokens: {} torch_dtype: null + attn_implementation: eager agents: null diff --git a/native_parallel/train/train_magrpo.py b/native_parallel/train/train_magrpo.py index 59d10fe..117e61a 100644 --- a/native_parallel/train/train_magrpo.py +++ b/native_parallel/train/train_magrpo.py @@ -239,6 +239,7 @@ def main() -> None: tokenizer=tokenizers if agent_names else tokenizers[0], model_config={ "torch_dtype": model_config.torch_dtype, + "attn_implementation": model_config.attn_implementation, "special_tokens": model_config.special_tokens, }, train_dataset=train_dataset, From e233fc1a8cfb9e3772cd8b94afdfa9e703f0a0b5 Mon Sep 17 00:00:00 2001 From: N!no Date: Tue, 7 Jul 2026 21:55:03 -0400 Subject: [PATCH 2/6] add a knot about the self dedup --- .../baseline/single_agent/config.yaml | 2 ++ .../single_agent/eval_single_agent.py | 3 ++ .../native_parallel_magrpo_config.yaml | 2 ++ native_parallel/logger.py | 3 ++ .../rewards/native_parallel_reward.py | 36 +++++++++++++++++++ 5 files changed, 46 insertions(+) diff --git a/native_parallel/baseline/single_agent/config.yaml b/native_parallel/baseline/single_agent/config.yaml index e39f8b6..a4a6f27 100644 --- a/native_parallel/baseline/single_agent/config.yaml +++ b/native_parallel/baseline/single_agent/config.yaml @@ -40,6 +40,8 @@ bfcl_reward: overlap_penalty: 0.20 lazy_agent_penalty: 0.15 extra_call_penalty: 0.05 + self_duplicate_mode: dedupe + self_duplicate_penalty: 0.10 min_reward: -0.4 max_reward: 1.2 diff --git a/native_parallel/baseline/single_agent/eval_single_agent.py b/native_parallel/baseline/single_agent/eval_single_agent.py index 81676cf..dc45f4c 100644 --- a/native_parallel/baseline/single_agent/eval_single_agent.py +++ b/native_parallel/baseline/single_agent/eval_single_agent.py @@ -156,6 +156,9 @@ def _summarize(records: List[Dict[str, Any]]) -> Dict[str, float]: "gold_call_count", "balance_score", "overlap_rate", + "self_duplicate_count", + "self_duplicate_rate", + "self_duplicate_penalty", "lazy_rate", "extra_call_rate", ] diff --git a/native_parallel/configs/native_parallel_magrpo_config.yaml b/native_parallel/configs/native_parallel_magrpo_config.yaml index 2fad7e3..bffc5cd 100644 --- a/native_parallel/configs/native_parallel_magrpo_config.yaml +++ b/native_parallel/configs/native_parallel_magrpo_config.yaml @@ -46,6 +46,8 @@ bfcl_reward: overlap_penalty: 0.20 lazy_agent_penalty: 0.15 extra_call_penalty: 0.05 + self_duplicate_mode: dedupe + self_duplicate_penalty: 0.10 min_reward: -0.4 max_reward: 1.2 diff --git a/native_parallel/logger.py b/native_parallel/logger.py index 115f625..9cf3e1f 100644 --- a/native_parallel/logger.py +++ b/native_parallel/logger.py @@ -87,6 +87,9 @@ def aggregate_native_parallel_metrics( "balance_score", "overlap_count", "overlap_rate", + "self_duplicate_count", + "self_duplicate_rate", + "self_duplicate_penalty", "lazy_agents", "lazy_rate", "extra_call_rate", diff --git a/native_parallel/rewards/native_parallel_reward.py b/native_parallel/rewards/native_parallel_reward.py index ccd2c39..0edfbaa 100644 --- a/native_parallel/rewards/native_parallel_reward.py +++ b/native_parallel/rewards/native_parallel_reward.py @@ -115,6 +115,17 @@ def _cross_agent_overlap(agent_calls: Sequence[Sequence[ToolCall]]) -> int: return sum(max(0, count - 1) for count in key_counts.values()) +def _same_agent_duplicate_count( + raw_agent_calls: Sequence[Sequence[ToolCall]], + deduped_agent_calls: Sequence[Sequence[ToolCall]], +) -> Tuple[int, List[int]]: + per_agent = [ + max(0, len(raw_calls) - len(deduped_calls)) + for raw_calls, deduped_calls in zip(raw_agent_calls, deduped_agent_calls) + ] + return sum(per_agent), per_agent + + def _clamp(value: float, lower: float, upper: float) -> float: return max(lower, min(upper, value)) @@ -130,9 +141,19 @@ class NativeParallelRewardConfig: overlap_penalty: float = 0.20 lazy_agent_penalty: float = 0.15 extra_call_penalty: float = 0.05 + self_duplicate_mode: str = "dedupe" + self_duplicate_penalty: float = 0.10 min_reward: float = -0.4 max_reward: float = 1.2 + def __post_init__(self) -> None: + mode = str(self.self_duplicate_mode or "dedupe").strip().lower() + if mode not in {"dedupe", "penalize"}: + raise ValueError( + "bfcl_reward.self_duplicate_mode must be one of: dedupe, penalize." + ) + self.self_duplicate_mode = mode + @classmethod def from_dict(cls, raw: Dict[str, Any]) -> "NativeParallelRewardConfig": allowed = set(cls.__dataclass_fields__.keys()) @@ -200,6 +221,15 @@ def score_native_parallel_response( balance_score = _balance_score(agent_counts, gold_count) overlap_count = _cross_agent_overlap(per_agent_calls) overlap_rate = min(1.0, overlap_count / max(1, gold_count)) + self_duplicate_count, per_agent_duplicate_counts = _same_agent_duplicate_count( + raw_per_agent_calls, per_agent_calls + ) + self_duplicate_rate = min(1.0, self_duplicate_count / max(1, gold_count)) + self_duplicate_penalty = ( + cfg.self_duplicate_penalty * self_duplicate_rate + if cfg.self_duplicate_mode == "penalize" + else 0.0 + ) lazy_agents = sum(1 for count in agent_counts if count == 0) lazy_rate = lazy_agents / max(1, len(agent_counts)) extra_calls = max(0, pred_count - gold_count) @@ -217,6 +247,7 @@ def score_native_parallel_response( - cfg.overlap_penalty * overlap_rate - cfg.lazy_agent_penalty * lazy_rate - cfg.extra_call_penalty * extra_rate + - self_duplicate_penalty ) reward = _clamp(reward, cfg.min_reward, cfg.max_reward) @@ -235,10 +266,15 @@ def score_native_parallel_response( "balance_score": float(balance_score), "overlap_count": float(overlap_count), "overlap_rate": float(overlap_rate), + "self_duplicate_count": float(self_duplicate_count), + "self_duplicate_rate": float(self_duplicate_rate), + "self_duplicate_penalty": float(self_duplicate_penalty), "lazy_agents": float(lazy_agents), "lazy_rate": float(lazy_rate), "extra_call_rate": float(extra_rate), "agent_call_counts": agent_counts, + "per_agent_duplicate_counts": per_agent_duplicate_counts, + "self_duplicate_mode": cfg.self_duplicate_mode, "combined_calls": [ {"name": call.name, "arguments": call.arguments} for call in combined_calls ], From 0984aca0fce7ef26800321fbe8dcddff69140ccd Mon Sep 17 00:00:00 2001 From: N!no Date: Wed, 8 Jul 2026 08:52:57 -0400 Subject: [PATCH 3/6] redundant: use alg to control max_length --- multiturn_flat/baseline/single_agent/config.yaml | 1 - multiturn_flat/config.py | 2 -- multiturn_flat/configs/multiturn_flat_magrpo_config.yaml | 1 - native_parallel/baseline/single_agent/config.yaml | 1 - native_parallel/config.py | 2 -- native_parallel/configs/native_parallel_magrpo_config.yaml | 1 - 6 files changed, 8 deletions(-) diff --git a/multiturn_flat/baseline/single_agent/config.yaml b/multiturn_flat/baseline/single_agent/config.yaml index 0f71b2f..7899f95 100644 --- a/multiturn_flat/baseline/single_agent/config.yaml +++ b/multiturn_flat/baseline/single_agent/config.yaml @@ -4,7 +4,6 @@ agent_model: temperature: 0.7 top_p: 0.8 top_k: null - max_length: 4096 special_tokens: {} torch_dtype: null attn_implementation: eager diff --git a/multiturn_flat/config.py b/multiturn_flat/config.py index 214e6d8..1e3bac7 100644 --- a/multiturn_flat/config.py +++ b/multiturn_flat/config.py @@ -17,7 +17,6 @@ class ModelConfig: temperature: Optional[float] = None top_p: Optional[float] = None top_k: Optional[int] = None - max_length: int = 4096 special_tokens: Dict[str, str] = field(default_factory=dict) torch_dtype: Optional[str] = None attn_implementation: Optional[str] = "sdpa" @@ -70,7 +69,6 @@ def _as_optional_int(value: Any) -> Optional[int]: temperature=temperature, top_p=top_p, top_k=top_k, - max_length=config_dict.get("max_length", 4096), special_tokens=config_dict.get("special_tokens", {}), torch_dtype=(config_dict.get("torch_dtype") or config_dict.get("dtype")), attn_implementation=config_dict.get("attn_implementation", "sdpa"), diff --git a/multiturn_flat/configs/multiturn_flat_magrpo_config.yaml b/multiturn_flat/configs/multiturn_flat_magrpo_config.yaml index 149b617..81df410 100644 --- a/multiturn_flat/configs/multiturn_flat_magrpo_config.yaml +++ b/multiturn_flat/configs/multiturn_flat_magrpo_config.yaml @@ -4,7 +4,6 @@ agent_model: temperature: 0.7 top_p: 0.8 top_k: null - max_length: 4096 special_tokens: {} torch_dtype: null attn_implementation: eager diff --git a/native_parallel/baseline/single_agent/config.yaml b/native_parallel/baseline/single_agent/config.yaml index a4a6f27..57c6200 100644 --- a/native_parallel/baseline/single_agent/config.yaml +++ b/native_parallel/baseline/single_agent/config.yaml @@ -4,7 +4,6 @@ agent_model: temperature: 0.7 top_p: 0.8 top_k: null - max_length: 4096 special_tokens: {} torch_dtype: null attn_implementation: eager diff --git a/native_parallel/config.py b/native_parallel/config.py index 19cc749..38b8cbc 100644 --- a/native_parallel/config.py +++ b/native_parallel/config.py @@ -17,7 +17,6 @@ class ModelConfig: temperature: Optional[float] = None top_p: Optional[float] = None top_k: Optional[int] = None - max_length: int = 4096 special_tokens: Dict[str, str] = field(default_factory=dict) torch_dtype: Optional[str] = None attn_implementation: Optional[str] = "sdpa" @@ -70,7 +69,6 @@ def _as_optional_int(value: Any) -> Optional[int]: temperature=temperature, top_p=top_p, top_k=top_k, - max_length=config_dict.get("max_length", 4096), special_tokens=config_dict.get("special_tokens", {}), torch_dtype=(config_dict.get("torch_dtype") or config_dict.get("dtype")), attn_implementation=config_dict.get("attn_implementation", "sdpa"), diff --git a/native_parallel/configs/native_parallel_magrpo_config.yaml b/native_parallel/configs/native_parallel_magrpo_config.yaml index bffc5cd..cd1110c 100644 --- a/native_parallel/configs/native_parallel_magrpo_config.yaml +++ b/native_parallel/configs/native_parallel_magrpo_config.yaml @@ -4,7 +4,6 @@ agent_model: temperature: 0.7 top_p: 0.8 top_k: null - max_length: 4096 special_tokens: {} torch_dtype: null attn_implementation: eager From 0c1f43faef857be673e11f6eed26c7167d17f019 Mon Sep 17 00:00:00 2001 From: N!no Date: Wed, 8 Jul 2026 09:24:27 -0400 Subject: [PATCH 4/6] bf16 --- multiturn_flat/baseline/single_agent/config.yaml | 2 +- multiturn_flat/configs/multiturn_flat_magrpo_config.yaml | 2 +- native_parallel/baseline/single_agent/config.yaml | 2 +- native_parallel/configs/native_parallel_magrpo_config.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/multiturn_flat/baseline/single_agent/config.yaml b/multiturn_flat/baseline/single_agent/config.yaml index 7899f95..c31ce50 100644 --- a/multiturn_flat/baseline/single_agent/config.yaml +++ b/multiturn_flat/baseline/single_agent/config.yaml @@ -5,7 +5,7 @@ agent_model: top_p: 0.8 top_k: null special_tokens: {} - torch_dtype: null + torch_dtype: bfloat16 attn_implementation: eager dataset: diff --git a/multiturn_flat/configs/multiturn_flat_magrpo_config.yaml b/multiturn_flat/configs/multiturn_flat_magrpo_config.yaml index 81df410..026eaaa 100644 --- a/multiturn_flat/configs/multiturn_flat_magrpo_config.yaml +++ b/multiturn_flat/configs/multiturn_flat_magrpo_config.yaml @@ -5,7 +5,7 @@ agent_model: top_p: 0.8 top_k: null special_tokens: {} - torch_dtype: null + torch_dtype: bfloat16 attn_implementation: eager agents: null diff --git a/native_parallel/baseline/single_agent/config.yaml b/native_parallel/baseline/single_agent/config.yaml index 57c6200..5e2ec50 100644 --- a/native_parallel/baseline/single_agent/config.yaml +++ b/native_parallel/baseline/single_agent/config.yaml @@ -5,7 +5,7 @@ agent_model: top_p: 0.8 top_k: null special_tokens: {} - torch_dtype: null + torch_dtype: bfloat16 attn_implementation: eager dataset: diff --git a/native_parallel/configs/native_parallel_magrpo_config.yaml b/native_parallel/configs/native_parallel_magrpo_config.yaml index cd1110c..0f3f492 100644 --- a/native_parallel/configs/native_parallel_magrpo_config.yaml +++ b/native_parallel/configs/native_parallel_magrpo_config.yaml @@ -5,7 +5,7 @@ agent_model: top_p: 0.8 top_k: null special_tokens: {} - torch_dtype: null + torch_dtype: bfloat16 attn_implementation: eager agents: null From 44436bc7f3add5248cc30a53bd447dad5b886411 Mon Sep 17 00:00:00 2001 From: N!no Date: Wed, 8 Jul 2026 14:56:47 -0400 Subject: [PATCH 5/6] change default not using live --- README.md | 5 +++-- native_parallel/baseline/single_agent/config.yaml | 2 -- .../configs/native_parallel_magrpo_config.yaml | 2 -- native_parallel/data.py | 8 ++++++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 9abb710..714f224 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,9 @@ Key fields: `native_parallel/` contains the native single-turn BFCL parallel task: -- categories: `parallel`, `parallel_multiple`, `live_parallel`, - `live_parallel_multiple` +- default categories: `parallel`, `parallel_multiple` +- live categories remain supported via `dataset.categories` overrides: + `live_parallel`, `live_parallel_multiple` - reward: flat aggregate joint reward - dataset: `OpenMLRL/BFCL-V4-Parallel-Native` - config: `native_parallel/configs/native_parallel_magrpo_config.yaml` diff --git a/native_parallel/baseline/single_agent/config.yaml b/native_parallel/baseline/single_agent/config.yaml index 5e2ec50..04b02f1 100644 --- a/native_parallel/baseline/single_agent/config.yaml +++ b/native_parallel/baseline/single_agent/config.yaml @@ -16,8 +16,6 @@ dataset: categories: - parallel - parallel_multiple - - live_parallel - - live_parallel_multiple task_types: null max_eval_samples: null diff --git a/native_parallel/configs/native_parallel_magrpo_config.yaml b/native_parallel/configs/native_parallel_magrpo_config.yaml index 0f3f492..67fea15 100644 --- a/native_parallel/configs/native_parallel_magrpo_config.yaml +++ b/native_parallel/configs/native_parallel_magrpo_config.yaml @@ -19,8 +19,6 @@ dataset: categories: - parallel - parallel_multiple - - live_parallel - - live_parallel_multiple task_types: null max_train_samples: null max_eval_samples: null diff --git a/native_parallel/data.py b/native_parallel/data.py index c42dfdf..1e4d99e 100644 --- a/native_parallel/data.py +++ b/native_parallel/data.py @@ -13,6 +13,10 @@ DEFAULT_NATIVE_CATEGORIES = ( "parallel", "parallel_multiple", +) + +ALLOWED_NATIVE_CATEGORIES = ( + *DEFAULT_NATIVE_CATEGORIES, "live_parallel", "live_parallel_multiple", ) @@ -71,11 +75,11 @@ def _filter_rows( max_samples: Optional[int] = None, ) -> List[Dict[str, Any]]: category_set = set(categories) - invalid = sorted(category_set - set(DEFAULT_NATIVE_CATEGORIES)) + invalid = sorted(category_set - set(ALLOWED_NATIVE_CATEGORIES)) if invalid: raise ValueError( "Native parallel categories must be one of " - f"{list(DEFAULT_NATIVE_CATEGORIES)}; got {invalid}." + f"{list(ALLOWED_NATIVE_CATEGORIES)}; got {invalid}." ) task_type_set = set(task_types) if task_types else None From db900ec7f36d37435913f0c51dbc65cfdbee4d65 Mon Sep 17 00:00:00 2001 From: N!no Date: Wed, 8 Jul 2026 15:49:14 -0400 Subject: [PATCH 6/6] always panelize self dup to save output max for diversity --- .../baseline/single_agent/config.yaml | 1 - .../configs/native_parallel_magrpo_config.yaml | 1 - .../rewards/native_parallel_reward.py | 16 +--------------- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/native_parallel/baseline/single_agent/config.yaml b/native_parallel/baseline/single_agent/config.yaml index 04b02f1..8d0fe02 100644 --- a/native_parallel/baseline/single_agent/config.yaml +++ b/native_parallel/baseline/single_agent/config.yaml @@ -37,7 +37,6 @@ bfcl_reward: overlap_penalty: 0.20 lazy_agent_penalty: 0.15 extra_call_penalty: 0.05 - self_duplicate_mode: dedupe self_duplicate_penalty: 0.10 min_reward: -0.4 max_reward: 1.2 diff --git a/native_parallel/configs/native_parallel_magrpo_config.yaml b/native_parallel/configs/native_parallel_magrpo_config.yaml index 67fea15..543223f 100644 --- a/native_parallel/configs/native_parallel_magrpo_config.yaml +++ b/native_parallel/configs/native_parallel_magrpo_config.yaml @@ -43,7 +43,6 @@ bfcl_reward: overlap_penalty: 0.20 lazy_agent_penalty: 0.15 extra_call_penalty: 0.05 - self_duplicate_mode: dedupe self_duplicate_penalty: 0.10 min_reward: -0.4 max_reward: 1.2 diff --git a/native_parallel/rewards/native_parallel_reward.py b/native_parallel/rewards/native_parallel_reward.py index 0edfbaa..3755c9b 100644 --- a/native_parallel/rewards/native_parallel_reward.py +++ b/native_parallel/rewards/native_parallel_reward.py @@ -141,19 +141,10 @@ class NativeParallelRewardConfig: overlap_penalty: float = 0.20 lazy_agent_penalty: float = 0.15 extra_call_penalty: float = 0.05 - self_duplicate_mode: str = "dedupe" self_duplicate_penalty: float = 0.10 min_reward: float = -0.4 max_reward: float = 1.2 - def __post_init__(self) -> None: - mode = str(self.self_duplicate_mode or "dedupe").strip().lower() - if mode not in {"dedupe", "penalize"}: - raise ValueError( - "bfcl_reward.self_duplicate_mode must be one of: dedupe, penalize." - ) - self.self_duplicate_mode = mode - @classmethod def from_dict(cls, raw: Dict[str, Any]) -> "NativeParallelRewardConfig": allowed = set(cls.__dataclass_fields__.keys()) @@ -225,11 +216,7 @@ def score_native_parallel_response( raw_per_agent_calls, per_agent_calls ) self_duplicate_rate = min(1.0, self_duplicate_count / max(1, gold_count)) - self_duplicate_penalty = ( - cfg.self_duplicate_penalty * self_duplicate_rate - if cfg.self_duplicate_mode == "penalize" - else 0.0 - ) + self_duplicate_penalty = cfg.self_duplicate_penalty * self_duplicate_rate lazy_agents = sum(1 for count in agent_counts if count == 0) lazy_rate = lazy_agents / max(1, len(agent_counts)) extra_calls = max(0, pred_count - gold_count) @@ -274,7 +261,6 @@ def score_native_parallel_response( "extra_call_rate": float(extra_rate), "agent_call_counts": agent_counts, "per_agent_duplicate_counts": per_agent_duplicate_counts, - "self_duplicate_mode": cfg.self_duplicate_mode, "combined_calls": [ {"name": call.name, "arguments": call.arguments} for call in combined_calls ],