Skip to content

Commit 72561e5

Browse files
committed
Update mars.py
1 parent 1d80ca0 commit 72561e5

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

optillm/mars/mars.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,24 @@
4545
'cross_agent_enhancement': True, # Generate enhanced solutions using peer strategies
4646
}
4747

48+
# Lightweight MARS configuration for coding benchmarks (faster, simpler)
49+
LIGHTWEIGHT_CONFIG = {
50+
'num_agents': 2, # Reduced from 3
51+
'max_iterations': 2, # Reduced from 5 for speed
52+
'verification_passes_required': 1, # Reduced from 2
53+
'consensus_threshold': 1, # Adjusted for 2-agent setup
54+
'min_verified_solutions': 1,
55+
'max_tokens': 4000, # Much smaller for coding
56+
'max_verification_attempts': 2, # Reduced from 3
57+
'early_termination': True,
58+
'use_reasoning_api': True,
59+
# Disable expensive features for coding
60+
'enable_aggregation': False, # Skip RSA aggregation
61+
'enable_strategy_network': False, # Skip strategy network
62+
'strategy_extraction_enabled': False,
63+
'cross_agent_enhancement': False,
64+
}
65+
4866
def multi_agent_reasoning_system(
4967
system_prompt: str,
5068
initial_query: str,
@@ -84,8 +102,12 @@ async def _run_mars_parallel(
84102
logger.info(f"🚀 MARS INITIALIZATION - Starting MARS with model: {model}")
85103
logger.info(f"📝 PROBLEM: {initial_query[:200]}{'...' if len(initial_query) > 200 else ''}")
86104

87-
# Initialize configuration
88-
config = DEFAULT_CONFIG.copy()
105+
# Initialize configuration - use lightweight config for coding if max_tokens <= 4000
106+
use_lightweight = request_config and request_config.get('max_tokens', 64000) <= 4000
107+
config = LIGHTWEIGHT_CONFIG.copy() if use_lightweight else DEFAULT_CONFIG.copy()
108+
109+
if use_lightweight:
110+
logger.info(f"⚡ CONFIG: Using LIGHTWEIGHT MARS config for coding (fast mode)")
89111

90112
# Override max_tokens from request_config if provided
91113
if request_config and 'max_tokens' in request_config:

0 commit comments

Comments
 (0)