@@ -32,6 +32,9 @@ class LLMModelConfig:
3232 timeout : int = None
3333 retries : int = None
3434 retry_delay : int = None
35+
36+ # Reproducibility
37+ random_seed : Optional [int ] = None
3538
3639
3740@dataclass
@@ -97,6 +100,7 @@ def __post_init__(self):
97100 "timeout" : self .timeout ,
98101 "retries" : self .retries ,
99102 "retry_delay" : self .retry_delay ,
103+ "random_seed" : self .random_seed ,
100104 }
101105 self .update_model_params (shared_config )
102106
@@ -165,7 +169,7 @@ class DatabaseConfig:
165169 migration_rate : float = 0.1 # Fraction of population to migrate
166170
167171 # Random seed for reproducible sampling
168- random_seed : Optional [int ] = None
172+ random_seed : Optional [int ] = 42
169173
170174 # Artifact storage
171175 artifacts_base_path : Optional [str ] = None # Defaults to db_path/artifacts
@@ -212,7 +216,7 @@ class Config:
212216 checkpoint_interval : int = 100
213217 log_level : str = "INFO"
214218 log_dir : Optional [str ] = None
215- random_seed : Optional [int ] = None
219+ random_seed : Optional [int ] = 42
216220
217221 # Component configurations
218222 llm : LLMConfig = field (default_factory = LLMConfig )
@@ -256,6 +260,10 @@ def from_dict(cls, config_dict: Dict[str, Any]) -> "Config":
256260 config .prompt = PromptConfig (** config_dict ["prompt" ])
257261 if "database" in config_dict :
258262 config .database = DatabaseConfig (** config_dict ["database" ])
263+
264+ # Ensure database inherits the random seed if not explicitly set
265+ if config .database .random_seed is None and config .random_seed is not None :
266+ config .database .random_seed = config .random_seed
259267 if "evaluator" in config_dict :
260268 config .evaluator = EvaluatorConfig (** config_dict ["evaluator" ])
261269
0 commit comments