"""Constants requiring experimental optimization."""
from wisent.core.grp_05.sub_constants.for_experiments.sub_exp.sub_exp2._exp_08 import *  # noqa: F401,F403


# --- Nonsense detection parser defaults ---
NONSENSE_REPETITION_THRESHOLD = 0.7
NONSENSE_GIBBERISH_THRESHOLD = 0.3

# --- Token steering parser defaults ---
TOKEN_DECAY_RATE_DEFAULT = 0.5
TOKEN_MIN_STRENGTH_DEFAULT = 0.1
TOKEN_PROMPT_STRENGTH_MULTIPLIER = 0.1

# --- Steering strength ranges ---
STEERING_STRENGTH_RANGE_WIDE = (0.1, 5.0)
STEERING_STRENGTH_RANGE_NARROW = (0.1, 3.0)

# --- Optuna classifier config ranges ---
OPTUNA_HIDDEN_DIM_RANGE = (32, 512)
OPTUNA_THRESHOLD_RANGE = (0.3, 0.9)
OPTUNA_EPOCH_RANGE = (20, 100)

# --- Weight optimization ranges ---
OPTI_WEIGHTS_STRENGTH_RANGE = (0.5, 2.0)
OPTI_WEIGHTS_MAX_WEIGHT_RANGE = (0.1, 1.0)
OPTI_WEIGHTS_MIN_WEIGHT_RANGE = (0.0, 0.3)
OPTI_WEIGHTS_POSITION_RANGE = (0.3, 0.7)

# --- Steering optimizer defaults ---
STEERING_OPTI_SAMPLE_SIZE = 64

# --- Diagnostic MLP hidden sizes ---
DIAGNOSTIC_MLP_HIDDEN_SIZES = (64,)

# --- Clustering defaults ---
KMEANS_N_INIT_DEFAULT = 20

# --- Relevance semantic scoring weights ---
RELEVANCE_CONTENT_MATCH_SCORE = 3
RELEVANCE_TAG_MATCH_SCORE = 2
RELEVANCE_POPULAR_BENCHMARK_BONUS = 0.5
RELEVANCE_FAST_HIGH_SCORING_BONUS = 1.0
RELEVANCE_HIGH_SCORING_BONUS = 0.3
RELEVANCE_MEDIUM_SCORING_BONUS = 0.1

# --- Geometry optimization ---
GEOMETRY_DEFAULT_NUM_COMPONENTS = 5

# --- Default layer weight (used in .get(layer, 1.0) patterns) ---
DEFAULT_LAYER_WEIGHT = 1.0

# --- Parser strength range defaults ---
PARSER_STRENGTH_RANGE_METHODS = (0.1, 2.0)
PARSER_STRENGTH_RANGE_PERSONALIZATION = (0.5, 5.0)
PARSER_STRENGTH_RANGE_WELFARE = (0.5, 3.0)

# --- Optuna pruner ---
OPTUNA_PRUNER_STARTUP_TRIALS = 5

# --- Test steering ---
TEST_STEERING_SCALE = 0.5

# --- Search space ---
THRESHOLD_RANGE_SHORT = (0.3, 0.5, 0.7)

# --- Minimum pair thresholds ---
MIN_CONCEPT_PAIRS = 10
MIN_PAIRS_FOR_LINEARITY = 10

# --- Zwiad clustering ---
ZWIAD_PCA_COMPONENTS = 3
ZWIAD_KMEANS_PRIMARY_CLUSTERS = 8
ZWIAD_KMEANS_SECONDARY_CLUSTERS = 5

# --- GROM training defaults ---
GROM_SIGNIFICANT_DIRECTIONS_DEFAULT = 3

# --- Diagnostic MLP hidden sizes (large) ---
DIAGNOSTIC_MLP_HIDDEN_SIZES_LARGE = (256, 128)

# --- Comparison module training defaults ---
COMPARISON_LORA_LEARNING_RATE = 2e-4
COMPARISON_REFT_LEARNING_RATE = 5e-4
COMPARISON_NUM_EPOCHS_DEFAULT = 3

# --- SAE training defaults ---
SAE_N_EPOCHS_DEFAULT = 500
SAE_L1_COEF_DEFAULT = 5e-4

# --- BOS feature detection defaults ---
BOS_NUM_SAMPLES_DEFAULT = 2000
BOS_MIN_LENGTH_DEFAULT = 50

# --- Comparison module steering evaluation ---
COMPARISON_STEERING_SCALES = (1.0, 2.0, 4.0)

# --- LoRA DPO training defaults ---
LORA_DPO_LEARNING_RATE = 5e-5
LORA_DPO_NUM_EPOCHS = 1

# --- LoReFT defaults ---
LOREFT_DEFAULT_RANK = 4

# --- SAE feature selection ---
SAE_TOP_K_DEFAULT = 4

# --- K-Means n_init variants ---
KMEANS_N_INIT_SMALL = 3
KMEANS_N_INIT_MEDIUM = 5
KMEANS_N_INIT_LARGE = 10

# --- LM harness sample counts ---
LM_HARNESS_NUM_SAMPLES_SMALL = 3
LM_HARNESS_NUM_SAMPLES_DEFAULT = 5

# --- Parser default num-pairs (CLI tools) ---
PARSER_DEFAULT_NUM_PAIRS_GENERATE = 30
PARSER_DEFAULT_NUM_PAIRS = 50
PARSER_DEFAULT_NUM_PAIRS_OPTIMIZE = 20
PARSER_DEFAULT_NUM_PAIRS_TRAIT = 10

# --- BOS argparse defaults ---
BOS_TOP_K_DEFAULT = 20
BOS_ARGPARSE_NUM_SAMPLES = 1000

# --- Extraction single benchmark limit ---
EXTRACTION_SINGLE_PAIR_LIMIT = 200

# --- Pair generator defaults ---
PAIR_GENERATORS_DEFAULT_N = 50

# --- Test/inspection defaults ---
NUM_EXAMPLES_DEFAULT = 5
MAX_DOCS_INSPECT = 100

# --- Abliteration ---
ABLITERATION_BASELINE_ACC = 0.44

# --- PCA gallery ---
PCA_GALLERY_COMPONENTS = 50

# --- GROM test defaults ---
GROM_TEST_HIDDEN_DIM = 256
GROM_TEST_N_SAMPLES = 30
GEOMETRY_OPTIMIZATION_STEPS_SMALL = 30

# --- Parser steering/epsilon/method defaults ---
PARSER_DEFAULT_EPSILON = 1.0
PARSER_DEFAULT_NUM_STRENGTH_STEPS = 5
PARSER_DEFAULT_MAX_CLUSTERS = 5
PARSER_DEFAULT_TEST_QUESTIONS = 5
PARSER_DEFAULT_RESPONSE_SAMPLES = 5

# --- Optuna defaults ---
OPTIMIZE_MAX_COMBINATIONS_DEFAULT = 100

# --- Test/detector defaults ---
TEST_DETECTOR_DEFAULT_LAYER = 6

# --- Detection/bootstrap defaults ---
N_BOOTSTRAP_DEFAULT = 100
MAX_K_DEFAULT = 6
CODING_BENCHMARK_DEFAULT_LIMIT = 5

# --- Test split ratio variants ---
SPLIT_RATIO_HALF = 0.5
SPLIT_RATIO_70 = 0.7

# --- Parser evaluation/generation defaults ---
PARSER_DEFAULT_EVAL_STRENGTH = 2.0
PARSER_DEFAULT_GENERATE_RESPONSES = 10
PARSER_DEFAULT_RANDOM_DIRECTIONS = 20
PARSER_DEFAULT_REF_PAIRS = 200
PARSER_DEFAULT_MIN_QUALITY = 2
PARSER_DEFAULT_TOTAL_SAMPLES = 1000
PARSER_DEFAULT_MAX_REGEN_ATTEMPTS = 3
PARSER_DEFAULT_CLASSIFICATION_THRESHOLD = 0.6
PARSER_DEFAULT_SYNTHETIC_PAIRS = 20
PARSER_DEFAULT_FEW_SHOT = 0
MIN_QUALITY_SCORE_OUTPUT = 50.0
MIN_SNR_EARLY_REJECT = 5.0
MIN_CV_SCORE_EARLY_REJECT = 0.1

# --- Optuna trial count variants ---
OPTUNA_TRIALS_LARGE = 300
OPTUNA_TRIALS_TUNE = 500

# --- Tune recommendation defaults ---
BENCHMARKS_PER_TYPE = 2
TOPK_OBJECTIVE_K = 2
SENSITIVITY_TOP_CONSTANTS = 20

# --- Optimization time limits (minutes) ---
OPTIMIZE_MAX_TIME_MINUTES_SHORT = 15.0
OPTIMIZE_MAX_TIME_MINUTES = 30.0
KMEANS_MAX_ITERATIONS_DEFAULT = 50
DIRECTIONS_PER_LAYER = 5

# --- Classification threshold range ---
CLASSIFICATION_THRESHOLD_RANGE = [0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]

# --- Weight optimization search space (string-encoded min,max ranges) ---
WEIGHT_OPT_STRENGTH_RANGE = "0.3,2.0"
WEIGHT_OPT_MAX_WEIGHT_RANGE = "0.5,3.0"
WEIGHT_OPT_MIN_WEIGHT_RANGE = "0.0,0.5"
WEIGHT_OPT_POSITION_RANGE = "0.3,0.7"

# --- Steering evaluation scales (string-encoded) ---
STEERING_EVAL_SCALES_DEFAULT = "0.0,0.5,1.0,1.5,2.0"

# --- Test/runner limits ---
TEST_DEFAULT_LIMIT = 10
QWEN3_4B_DEFAULT_LAYER = 17

# --- SAE analysis ---
SAE_HIDDEN_DIM_MULTIPLIER = 4
SAE_TOP_K_ANALYSIS = 20

# --- Abliteration search defaults ---
ABLITERATION_NUM_PAIRS = 300
ABLITERATION_DEFAULT_POSITION = 8.0
ABLITERATION_DEFAULT_DISTANCE = 6.0
ABLITERATION_BINARY_SEARCH_LOW = 0.5
ABLITERATION_BINARY_SEARCH_HIGH = 3.0
ABLITERATION_BINARY_SEARCH_ITERS = 5

# --- Concept experiment ---
N_PAIRS_PER_CONCEPT_DEFAULT = 100

# --- Threshold analysis ---
THRESHOLD_HIDDEN_DIM_LARGE = 4096

# --- Concept detection ---
CONCEPT_DETECTION_DEFAULT_N = 2

# --- Extractor defaults ---
EXTRACTOR_DEFAULT_LIMIT = 500
EXTRACTOR_MIN_TEXT_LENGTH = 500

# --- Fast diversity ---
FAST_DIVERSITY_SEED = 13

# --- Nonsense generator ---
NONSENSE_DEFAULT_NUM_PAIRS = 10

# --- Classifier recency ---
CLASSIFIER_RECENCY_DAYS = 30

# --- Quality evaluation bounds ---
QUALITY_EVAL_LAYER_MIN = 8
QUALITY_EVAL_LAYER_MAX = 20
QUALITY_EVAL_SAMPLES_MIN = 10
QUALITY_EVAL_SAMPLES_MAX = 50

# --- Zwiad analysis limits ---
ZWIAD_ANALYSIS_LIMIT = 500
ZWIAD_ANALYSIS_LIMIT_SMALL = 200

# --- Token estimation ---
TOKENS_PER_PAIR_ESTIMATE = 150
TOKENS_BASE_OFFSET = 500
TOKEN_ESTIMATE_MIN = 2048
TOKEN_ESTIMATE_MAX = 8192

# --- SimHash dedup thresholds ---
SIMHASH_THRESHOLD_AGGRESSIVE = 10
SIMHASH_THRESHOLD_CONSERVATIVE = 3

# --- Dedup item threshold ---
DEDUP_ITEM_THRESHOLD = 1000

# --- Geometry structure thresholds ---
GEOMETRY_THRESHOLD_DEFAULT = 0.5
GEOMETRY_THRESHOLD_CLUSTER = 0.6
GEOMETRY_THRESHOLD_SPARSE = 0.7
GEOMETRY_THRESHOLD_MANIFOLD = 0.3
