Persona bottleneck sprint: ft_population
Browse filesFiles changed (33)
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/endpoints.jsonAdded+47
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/events.jsonlAdded+111
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step0000.ptAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step0001.ptAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step0003.ptAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step0005.ptAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step0009.ptAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step0018.ptAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step0040.ptAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step0100.ptAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step0300.ptAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step1000.ptAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/ft_selection.jsonAdded+11
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/guard_crossings.jsonAdded+59
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/manifest.jsonAdded+265
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/metrics.jsonAdded+162
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/prompts.npzAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step0000.npzAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step0001.npzAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step0003.npzAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step0005.npzAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step0009.npzAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step0018.npzAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step0040.npzAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step0100.npzAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step0300.npzAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step1000.npzAdded+3
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/selection.jsonAdded+24
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/source/bag_moments/pbm_progress.pyAdded+99
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/source/bag_moments/pbm_qualification.pyAdded+122
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/source/bag_moments/pbm_sprint.pyAdded+352
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/source/bag_moments/pbm_stratified.pyAdded+65
- old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/source/experiments/pbm_sprint_train.pyAdded+495
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647{ "0.1": { "target": 0.1, "guard": 0.02, "candidate_steps": [], "selection_bank": "endpoint_selection_T", "development_crossings_observed": [], "heldout_bank": "untouched_final_O", "max_width": 0.04, "equality_rule": "exact numeric equality", "selection_rule": "chronological adjacent upward candidates; smallest T width, then earliest upper step", "model_interpolation": false, "candidate_T_values": {}, "resolved": false, "reason": "no eligible upward T bracket within guard candidates" }, "0.2": { "target": 0.2, "guard": 0.02, "candidate_steps": [], "selection_bank": "endpoint_selection_T", "development_crossings_observed": [], "heldout_bank": "untouched_final_O", "max_width": 0.04, "equality_rule": "exact numeric equality", "selection_rule": "chronological adjacent upward candidates; smallest T width, then earliest upper step", "model_interpolation": false, "candidate_T_values": {}, "resolved": false, "reason": "no eligible upward T bracket within guard candidates" }, "0.3": { "target": 0.3, "guard": 0.02, "candidate_steps": [], "selection_bank": "endpoint_selection_T", "development_crossings_observed": [], "heldout_bank": "untouched_final_O", "max_width": 0.04, "equality_rule": "exact numeric equality", "selection_rule": "chronological adjacent upward candidates; smallest T width, then earliest upper step", "model_interpolation": false, "candidate_T_values": {}, "resolved": false, "reason": "no eligible upward T bracket within guard candidates" }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111{"elapsed_s": 0.0024635791778564453, "stage": "start", "mode": "finetune", "n": 128, "eta": 1.0, "parameters": 629120}{"elapsed_s": 2.037264347076416, "stage": "ft_evaluation", "step": 0, "tokens": 0, "T": {"readout": 0.49829243424755987, "change": 0.0, "paired_prompt_se": 0.0, "out_of_range": 0.0}, "O": {"readout": 0.50207883519397, "change": 0.0, "paired_prompt_se": 0.0, "out_of_range": 0.0}}{"elapsed_s": 2.651858329772949, "stage": "ft_evaluation", "step": 1, "tokens": 32768, "T": {"readout": 0.5048985397515935, "change": 0.006606105504033621, "paired_prompt_se": 6.834002118528218e-06, "out_of_range": 0.0}, "O": {"readout": 0.5083446053795342, "change": 0.006265770185564179, "paired_prompt_se": 6.521023362777162e-06, "out_of_range": 0.0}}{"elapsed_s": 2.750772476196289, "stage": "ft_evaluation", "step": 3, "tokens": 98304, "T": {"readout": 0.5109453245568147, "change": 0.012652890309254872, "paired_prompt_se": 1.5704064645167075e-05, "out_of_range": 0.0}, "O": {"readout": 0.5109496705808851, "change": 0.008870835386915132, "paired_prompt_se": 1.2633511708885897e-05, "out_of_range": 0.0}}{"elapsed_s": 2.8505187034606934, "stage": "ft_evaluation", "step": 5, "tokens": 163840, "T": {"readout": 0.5122063361268374, "change": 0.013913901879277546, "paired_prompt_se": 2.2529003022904434e-05, "out_of_range": 0.0}, "O": {"readout": 0.509931558091921, "change": 0.007852722897951026, "paired_prompt_se": 2.1070749615274466e-05, "out_of_range": 0.0}}{"elapsed_s": 2.99992036819458, "stage": "ft_evaluation", "step": 9, "tokens": 294912, "T": {"readout": 0.5100078322720947, "change": 0.011715398024534807, "paired_prompt_se": 3.5591599532720485e-05, "out_of_range": 0.0}, "O": {"readout": 0.5031418647886312, "change": 0.0010630295946612023, "paired_prompt_se": 2.3668235747175573e-05, "out_of_range": 0.0}}{"elapsed_s": 3.0295400619506836, "stage": "finetune", "step": 10, "loss": 1.273555874824524, "dev_progress": 0.009950078172551002, "crossed": [], "guard_crossed": {}}{"elapsed_s": 3.2625837326049805, "stage": "ft_evaluation", "step": 18, "tokens": 589824, "T": {"readout": 0.5020668646320701, "change": 0.0037744303845101967, "paired_prompt_se": 5.2687490901904784e-05, "out_of_range": 0.0}, "O": {"readout": 0.4915104804058501, "change": -0.010568354788119905, "paired_prompt_se": 5.8757948251286005e-05, "out_of_range": 0.0}}{"elapsed_s": 3.3149216175079346, "stage": "finetune", "step": 20, "loss": 1.2748041152954102, "dev_progress": -9.13691328605637e-05, "crossed": [], "guard_crossed": {}}{"elapsed_s": 3.5514798164367676, "stage": "finetune", "step": 30, "loss": 1.271181583404541, "dev_progress": -0.004649193047953304, "crossed": [], "guard_crossed": {}}{"elapsed_s": 3.835157871246338, "stage": "ft_evaluation", "step": 40, "tokens": 1310720, "T": {"readout": 0.49499153553915676, "change": -0.0033008987084031105, "paired_prompt_se": 5.882001290234592e-05, "out_of_range": 0.0}, "O": {"readout": 0.5019240274996264, "change": -0.00015480769434361719, "paired_prompt_se": 7.411059028263864e-05, "out_of_range": 0.0}}{"elapsed_s": 3.8406784534454346, "stage": "finetune", "step": 40, "loss": 1.2706363201141357, "dev_progress": -0.00306329014711082, "crossed": [], "guard_crossed": {}}{"elapsed_s": 4.077072381973267, "stage": "finetune", "step": 50, "loss": 1.2802588939666748, "dev_progress": -0.004314993289881386, "crossed": [], "guard_crossed": {}}{"elapsed_s": 4.31454610824585, "stage": "finetune", "step": 60, "loss": 1.2799526453018188, "dev_progress": 0.007707596610998735, "crossed": [], "guard_crossed": {}}{"elapsed_s": 4.5510759353637695, "stage": "finetune", "step": 70, "loss": 1.273069143295288, "dev_progress": 0.002550366203649901, "crossed": [], "guard_crossed": {}}{"elapsed_s": 4.788311719894409, "stage": "finetune", "step": 80, "loss": 1.2764534950256348, "dev_progress": 0.004288559946871828, "crossed": [], "guard_crossed": {}}{"elapsed_s": 5.025669574737549, "stage": "finetune", "step": 90, "loss": 1.2741588354110718, "dev_progress": -0.01102328703564126, "crossed": [], "guard_crossed": {}}{"elapsed_s": 5.3060595989227295, "stage": "ft_evaluation", "step": 100, "tokens": 3276800, "T": {"readout": 0.47669329443306196, "change": -0.021599139814497903, "paired_prompt_se": 5.822283055207258e-05, "out_of_range": 0.0}, "O": {"readout": 0.4912281241668097, "change": -0.010850711027160287, "paired_prompt_se": 8.084840929847391e-05, "out_of_range": 0.0}}{"elapsed_s": 5.311664581298828, "stage": "finetune", "step": 100, "loss": 1.2767605781555176, "dev_progress": -0.02149398875189945, "crossed": [], "guard_crossed": {}}{"elapsed_s": 5.5464184284210205, "stage": "finetune", "step": 110, "loss": 1.2720794677734375, "dev_progress": -0.013426545243419241, "crossed": [], "guard_crossed": {}}{"elapsed_s": 5.784510374069214, "stage": "finetune", "step": 120, "loss": 1.2767155170440674, "dev_progress": 0.0011468554512248375, "crossed": [], "guard_crossed": {}}{"elapsed_s": 6.021962642669678, "stage": "finetune", "step": 130, "loss": 1.2740793228149414, "dev_progress": -0.0009041731755132787, "crossed": [], "guard_crossed": {}}{"elapsed_s": 6.222350358963013, "stage": "finetune", "step": 140, "loss": 1.2794232368469238, "dev_progress": 0.00029266434285091236, "crossed": [], "guard_crossed": {}}{"elapsed_s": 6.4076902866363525, "stage": "finetune", "step": 150, "loss": 1.2741029262542725, "dev_progress": -0.0034324855587328784, "crossed": [], "guard_crossed": {}}{"elapsed_s": 6.6447858810424805, "stage": "finetune", "step": 160, "loss": 1.2764177322387695, "dev_progress": -0.0027696667093550786, "crossed": [], "guard_crossed": {}}{"elapsed_s": 6.8803300857543945, "stage": "finetune", "step": 170, "loss": 1.2740153074264526, "dev_progress": -0.00878226941858884, "crossed": [], "guard_crossed": {}}{"elapsed_s": 7.11687970161438, "stage": "finetune", "step": 180, "loss": 1.2771430015563965, "dev_progress": -0.004549045239400584, "crossed": [], "guard_crossed": {}}{"elapsed_s": 7.354970693588257, "stage": "finetune", "step": 190, "loss": 1.279520034790039, "dev_progress": 0.004654118500184268, "crossed": [], "guard_crossed": {}}{"elapsed_s": 7.590296745300293, "stage": "finetune", "step": 200, "loss": 1.273740530014038, "dev_progress": 0.01914176515128929, "crossed": [], "guard_crossed": {}}{"elapsed_s": 7.826447010040283, "stage": "finetune", "step": 210, "loss": 1.2785844802856445, "dev_progress": 0.02247613023064332, "crossed": [], "guard_crossed": {}}{"elapsed_s": 8.06080150604248, "stage": "finetune", "step": 220, "loss": 1.276291847229004, "dev_progress": 0.024899480296880938, "crossed": [], "guard_crossed": {}}{"elapsed_s": 8.297635316848755, "stage": "finetune", "step": 230, "loss": 1.2700731754302979, "dev_progress": 0.022019165349774994, "crossed": [], "guard_crossed": {}}{"elapsed_s": 8.533301830291748, "stage": "finetune", "step": 240, "loss": 1.2759525775909424, "dev_progress": 0.014132612370303832, "crossed": [], "guard_crossed": {}}{"elapsed_s": 8.770336627960205, "stage": "finetune", "step": 250, "loss": 1.276961088180542, "dev_progress": 0.007871067529777065, "crossed": [], "guard_crossed": {}}{"elapsed_s": 9.006581783294678, "stage": "finetune", "step": 260, "loss": 1.277754545211792, "dev_progress": -0.005877526171389036, "crossed": [], "guard_crossed": {}}{"elapsed_s": 9.242795705795288, "stage": "finetune", "step": 270, "loss": 1.282004714012146, "dev_progress": -0.0036119751966907643, "crossed": [], "guard_crossed": {}}{"elapsed_s": 9.479849338531494, "stage": "finetune", "step": 280, "loss": 1.2736637592315674, "dev_progress": -0.00578022872650763, "crossed": [], "guard_crossed": {}}{"elapsed_s": 9.717536926269531, "stage": "finetune", "step": 290, "loss": 1.2725266218185425, "dev_progress": 0.0003107685406575911, "crossed": [], "guard_crossed": {}}{"elapsed_s": 10.000721454620361, "stage": "ft_evaluation", "step": 300, "tokens": 9830400, "T": {"readout": 0.49492328306951094, "change": -0.0033691511780489236, "paired_prompt_se": 6.636893364983764e-05, "out_of_range": 0.0}, "O": {"readout": 0.49407598941616016, "change": -0.008002845777809853, "paired_prompt_se": 0.00012370222948403106, "out_of_range": 0.0}}{"elapsed_s": 10.005655527114868, "stage": "finetune", "step": 300, "loss": 1.2745847702026367, "dev_progress": -0.0033429709874326363, "crossed": [], "guard_crossed": {}}{"elapsed_s": 10.242348432540894, "stage": "finetune", "step": 310, "loss": 1.274921178817749, "dev_progress": 0.00460219395608874, "crossed": [], "guard_crossed": {}}{"elapsed_s": 10.432930707931519, "stage": "finetune", "step": 320, "loss": 1.2778651714324951, "dev_progress": 0.009047772742633242, "crossed": [], "guard_crossed": {}}{"elapsed_s": 10.632295608520508, "stage": "finetune", "step": 330, "loss": 1.2696497440338135, "dev_progress": 0.004132754176680464, "crossed": [], "guard_crossed": {}}{"elapsed_s": 10.870340824127197, "stage": "finetune", "step": 340, "loss": 1.2736679315567017, "dev_progress": 0.0033902012219186872, "crossed": [], "guard_crossed": {}}{"elapsed_s": 11.107177495956421, "stage": "finetune", "step": 350, "loss": 1.2746225595474243, "dev_progress": -0.005127925905981101, "crossed": [], "guard_crossed": {}}{"elapsed_s": 11.344245195388794, "stage": "finetune", "step": 360, "loss": 1.273235559463501, "dev_progress": -0.01382806799665559, "crossed": [], "guard_crossed": {}}{"elapsed_s": 11.582154750823975, "stage": "finetune", "step": 370, "loss": 1.2723474502563477, "dev_progress": -0.01943675932852784, "crossed": [], "guard_crossed": {}}{"elapsed_s": 11.819967985153198, "stage": "finetune", "step": 380, "loss": 1.2808504104614258, "dev_progress": -0.018896202542237006, "crossed": [], "guard_crossed": {}}{"elapsed_s": 12.056922674179077, "stage": "finetune", "step": 390, "loss": 1.2785344123840332, "dev_progress": -0.013946995430160314, "crossed": [], "guard_crossed": {}}{"elapsed_s": 12.29340672492981, "stage": "finetune", "step": 400, "loss": 1.282734751701355, "dev_progress": -0.012547445039672311, "crossed": [], "guard_crossed": {}}{"elapsed_s": 12.529325246810913, "stage": "finetune", "step": 410, "loss": 1.2748448848724365, "dev_progress": -0.010299203997419681, "crossed": [], "guard_crossed": {}}{"elapsed_s": 12.76416277885437, "stage": "finetune", "step": 420, "loss": 1.2743772268295288, "dev_progress": -0.0037154960227780975, "crossed": [], "guard_crossed": {}}{"elapsed_s": 12.999389410018921, "stage": "finetune", "step": 430, "loss": 1.275301456451416, "dev_progress": -0.004781177973200101, "crossed": [], "guard_crossed": {}}{"elapsed_s": 13.234166383743286, "stage": "finetune", "step": 440, "loss": 1.276566982269287, "dev_progress": -0.011901419231435284, "crossed": [], "guard_crossed": {}}{"elapsed_s": 13.470458507537842, "stage": "finetune", "step": 450, "loss": 1.2713892459869385, "dev_progress": 0.001213029885548167, "crossed": [], "guard_crossed": {}}{"elapsed_s": 13.706530570983887, "stage": "finetune", "step": 460, "loss": 1.280505895614624, "dev_progress": -0.0004549017467070371, "crossed": [], "guard_crossed": {}}{"elapsed_s": 13.942034244537354, "stage": "finetune", "step": 470, "loss": 1.272341012954712, "dev_progress": 0.0057282723355456255, "crossed": [], "guard_crossed": {}}{"elapsed_s": 14.176390409469604, "stage": "finetune", "step": 480, "loss": 1.2803188562393188, "dev_progress": 0.0051388448337092996, "crossed": [], "guard_crossed": {}}{"elapsed_s": 14.410850048065186, "stage": "finetune", "step": 490, "loss": 1.276230812072754, "dev_progress": -0.00468542987073306, "crossed": [], "guard_crossed": {}}{"elapsed_s": 14.609983921051025, "stage": "finetune", "step": 500, "loss": 1.269406795501709, "dev_progress": -0.011795358193921857, "crossed": [], "guard_crossed": {}}{"elapsed_s": 14.799742698669434, "stage": "finetune", "step": 510, "loss": 1.274592638015747, "dev_progress": -0.023760514523019083, "crossed": [], "guard_crossed": {}}{"elapsed_s": 15.039439678192139, "stage": "finetune", "step": 520, "loss": 1.2758264541625977, "dev_progress": -0.017453689673857298, "crossed": [], "guard_crossed": {}}{"elapsed_s": 15.274982213973999, "stage": "finetune", "step": 530, "loss": 1.2814949750900269, "dev_progress": -0.012729130692605395, "crossed": [], "guard_crossed": {}}{"elapsed_s": 15.512454271316528, "stage": "finetune", "step": 540, "loss": 1.270324945449829, "dev_progress": -0.0065695475350366905, "crossed": [], "guard_crossed": {}}{"elapsed_s": 15.74855351448059, "stage": "finetune", "step": 550, "loss": 1.2744098901748657, "dev_progress": -0.013452592567773536, "crossed": [], "guard_crossed": {}}{"elapsed_s": 15.984672784805298, "stage": "finetune", "step": 560, "loss": 1.277437448501587, "dev_progress": -0.01677706864575157, "crossed": [], "guard_crossed": {}}{"elapsed_s": 16.221556186676025, "stage": "finetune", "step": 570, "loss": 1.2751059532165527, "dev_progress": -0.00919503533077659, "crossed": [], "guard_crossed": {}}{"elapsed_s": 16.457720518112183, "stage": "finetune", "step": 580, "loss": 1.2752941846847534, "dev_progress": -0.00024048723571468145, "crossed": [], "guard_crossed": {}}{"elapsed_s": 16.693371057510376, "stage": "finetune", "step": 590, "loss": 1.2756015062332153, "dev_progress": -0.007903601239377167, "crossed": [], "guard_crossed": {}}{"elapsed_s": 16.93104314804077, "stage": "finetune", "step": 600, "loss": 1.274587631225586, "dev_progress": -0.007689102596486919, "crossed": [], "guard_crossed": {}}{"elapsed_s": 17.167718410491943, "stage": "finetune", "step": 610, "loss": 1.2778550386428833, "dev_progress": -0.0079463663205388, "crossed": [], "guard_crossed": {}}{"elapsed_s": 17.405224084854126, "stage": "finetune", "step": 620, "loss": 1.2740778923034668, "dev_progress": -0.01694492060050834, "crossed": [], "guard_crossed": {}}{"elapsed_s": 17.640586614608765, "stage": "finetune", "step": 630, "loss": 1.2745333909988403, "dev_progress": -0.03525048711890122, "crossed": [], "guard_crossed": {}}{"elapsed_s": 17.87666916847229, "stage": "finetune", "step": 640, "loss": 1.2776602506637573, "dev_progress": -0.03384923771955073, "crossed": [], "guard_crossed": {}}{"elapsed_s": 18.114257097244263, "stage": "finetune", "step": 650, "loss": 1.2775709629058838, "dev_progress": -0.019819368972093798, "crossed": [], "guard_crossed": {}}{"elapsed_s": 18.34920859336853, "stage": "finetune", "step": 660, "loss": 1.2749664783477783, "dev_progress": -0.014301498304121196, "crossed": [], "guard_crossed": {}}{"elapsed_s": 18.586246490478516, "stage": "finetune", "step": 670, "loss": 1.2773079872131348, "dev_progress": -0.006381835257343482, "crossed": [], "guard_crossed": {}}{"elapsed_s": 18.78641128540039, "stage": "finetune", "step": 680, "loss": 1.2752487659454346, "dev_progress": 0.0018375384825048968, "crossed": [], "guard_crossed": {}}{"elapsed_s": 18.975029468536377, "stage": "finetune", "step": 690, "loss": 1.2718462944030762, "dev_progress": 0.002270629789563827, "crossed": [], "guard_crossed": {}}{"elapsed_s": 19.21163296699524, "stage": "finetune", "step": 700, "loss": 1.2776353359222412, "dev_progress": -0.0046565366283175536, "crossed": [], "guard_crossed": {}}{"elapsed_s": 19.447147130966187, "stage": "finetune", "step": 710, "loss": 1.2782416343688965, "dev_progress": -0.008737747375562321, "crossed": [], "guard_crossed": {}}{"elapsed_s": 19.6832435131073, "stage": "finetune", "step": 720, "loss": 1.2804481983184814, "dev_progress": -0.01392921911610756, "crossed": [], "guard_crossed": {}}{"elapsed_s": 19.919250965118408, "stage": "finetune", "step": 730, "loss": 1.2702072858810425, "dev_progress": -0.012286402845347766, "crossed": [], "guard_crossed": {}}{"elapsed_s": 20.155123949050903, "stage": "finetune", "step": 740, "loss": 1.278212070465088, "dev_progress": -0.01084190426627174, "crossed": [], "guard_crossed": {}}{"elapsed_s": 20.390767812728882, "stage": "finetune", "step": 750, "loss": 1.2772419452667236, "dev_progress": -0.0028024206330883317, "crossed": [], "guard_crossed": {}}{"elapsed_s": 20.62675452232361, "stage": "finetune", "step": 760, "loss": 1.2730423212051392, "dev_progress": 0.005880783413886093, "crossed": [], "guard_crossed": {}}{"elapsed_s": 20.8616304397583, "stage": "finetune", "step": 770, "loss": 1.2765734195709229, "dev_progress": 0.00019745049212360755, "crossed": [], "guard_crossed": {}}{"elapsed_s": 21.098813772201538, "stage": "finetune", "step": 780, "loss": 1.2741291522979736, "dev_progress": -0.00039568408828927204, "crossed": [], "guard_crossed": {}}{"elapsed_s": 21.3339524269104, "stage": "finetune", "step": 790, "loss": 1.2704311609268188, "dev_progress": -0.015046065367641859, "crossed": [], "guard_crossed": {}}{"elapsed_s": 21.569295167922974, "stage": "finetune", "step": 800, "loss": 1.274863600730896, "dev_progress": -0.013475192594341934, "crossed": [], "guard_crossed": {}}{"elapsed_s": 21.804710865020752, "stage": "finetune", "step": 810, "loss": 1.2725985050201416, "dev_progress": -0.015801710011146497, "crossed": [], "guard_crossed": {}}{"elapsed_s": 22.04042363166809, "stage": "finetune", "step": 820, "loss": 1.2753217220306396, "dev_progress": -0.015504144466831349, "crossed": [], "guard_crossed": {}}{"elapsed_s": 22.275481700897217, "stage": "finetune", "step": 830, "loss": 1.272193193435669, "dev_progress": -0.0015226558825816028, "crossed": [], "guard_crossed": {}}{"elapsed_s": 22.511114835739136, "stage": "finetune", "step": 840, "loss": 1.2775719165802002, "dev_progress": 0.0018149828320019878, "crossed": [], "guard_crossed": {}}{"elapsed_s": 22.74548888206482, "stage": "finetune", "step": 850, "loss": 1.2764692306518555, "dev_progress": -0.011119089322164655, "crossed": [], "guard_crossed": {}}{"elapsed_s": 22.956169366836548, "stage": "finetune", "step": 860, "loss": 1.272615909576416, "dev_progress": -0.024763433204498142, "crossed": [], "guard_crossed": {}}{"elapsed_s": 23.14029335975647, "stage": "finetune", "step": 870, "loss": 1.2686055898666382, "dev_progress": -0.0295849792091758, "crossed": [], "guard_crossed": {}}{"elapsed_s": 23.370195388793945, "stage": "finetune", "step": 880, "loss": 1.271789789199829, "dev_progress": -0.021000573098717723, "crossed": [], "guard_crossed": {}}{"elapsed_s": 23.605422258377075, "stage": "finetune", "step": 890, "loss": 1.2791054248809814, "dev_progress": -0.008126919266942423, "crossed": [], "guard_crossed": {}}{"elapsed_s": 23.839864492416382, "stage": "finetune", "step": 900, "loss": 1.2747294902801514, "dev_progress": -0.0026724031995399855, "crossed": [], "guard_crossed": {}}{"elapsed_s": 24.074735403060913, "stage": "finetune", "step": 910, "loss": 1.2770402431488037, "dev_progress": -0.004604613590345252, "crossed": [], "guard_crossed": {}}{"elapsed_s": 24.30929732322693, "stage": "finetune", "step": 920, "loss": 1.2700096368789673, "dev_progress": -0.022535183939908165, "crossed": [], "guard_crossed": {}}{"elapsed_s": 24.54462170600891, "stage": "finetune", "step": 930, "loss": 1.2828454971313477, "dev_progress": -0.04273190628737211, "crossed": [], "guard_crossed": {}}{"elapsed_s": 24.779207468032837, "stage": "finetune", "step": 940, "loss": 1.2718727588653564, "dev_progress": -0.03248766481556231, "crossed": [], "guard_crossed": {}}{"elapsed_s": 25.01433229446411, "stage": "finetune", "step": 950, "loss": 1.276242733001709, "dev_progress": -0.031524485697445925, "crossed": [], "guard_crossed": {}}{"elapsed_s": 25.2505521774292, "stage": "finetune", "step": 960, "loss": 1.2742855548858643, "dev_progress": -0.03447515337029472, "crossed": [], "guard_crossed": {}}{"elapsed_s": 25.487014055252075, "stage": "finetune", "step": 970, "loss": 1.2743182182312012, "dev_progress": -0.03510225461650407, "crossed": [], "guard_crossed": {}}{"elapsed_s": 25.72300958633423, "stage": "finetune", "step": 980, "loss": 1.2755234241485596, "dev_progress": -0.032710305422369856, "crossed": [], "guard_crossed": {}}{"elapsed_s": 25.959922790527344, "stage": "finetune", "step": 990, "loss": 1.271277666091919, "dev_progress": -0.017535872051666956, "crossed": [], "guard_crossed": {}}{"elapsed_s": 26.24194073677063, "stage": "ft_evaluation", "step": 1000, "tokens": 32768000, "T": {"readout": 0.48961063601018395, "change": -0.008681798237375915, "paired_prompt_se": 0.00010052186606080712, "out_of_range": 0.0}, "O": {"readout": 0.5232639529385779, "change": 0.02118511774460785, "paired_prompt_se": 9.62840467942279e-05, "out_of_range": 0.0}}{"elapsed_s": 26.24683690071106, "stage": "finetune", "step": 1000, "loss": 1.2760536670684814, "dev_progress": -0.008553249441320077, "crossed": [], "guard_crossed": {}}123version https://git-lfs.github.com/spec/v1oid sha256:ca2b58985935bdcfe076b70aeef8d55d5f21f349b974a004b176a08da131408asize 3343829123version https://git-lfs.github.com/spec/v1oid sha256:f7e03a1a3b26487595c216df2cd465b6bd1418222856f4f1ad7bdcfbc6f21fc0size 8412210123version https://git-lfs.github.com/spec/v1oid sha256:c34764359d09fb8e72d84f46cad7728130b29be2e752b6a17f2744db2183c358size 8412210123version https://git-lfs.github.com/spec/v1oid sha256:91a6e02a2f8cc452aac08ca66e194a80595842a9233c6038849f1e855666437esize 8412210123version https://git-lfs.github.com/spec/v1oid sha256:17128f3f384bf42f203a1172705843fe2cbab5471ad6f69765ce1c634f534528size 8412210123version https://git-lfs.github.com/spec/v1oid sha256:6b8468875323136c7bed25e98438c42d11dc8600fe4936ce56fd9521c0654b3esize 8412210123version https://git-lfs.github.com/spec/v1oid sha256:e0c46e6e261de1450d7a5a5471a30ea20bfdf04464d33e4bc24a6f2b670137aesize 8412210123version https://git-lfs.github.com/spec/v1oid sha256:e89037053eb61db08f51ffae82f5032076754c3b459c91b125c92cc54ea035c9size 8412210123version https://git-lfs.github.com/spec/v1oid sha256:05740eb13e52b249e85a7e93b573942bdc7eb209a7c0c3f79dc805cb600bb5d7size 8412210123version https://git-lfs.github.com/spec/v1oid sha256:0c8ec4952a6f6efd3098949cce6e4378b24690894cb39628d0fd4ea422dec62bsize 84122101234567891011{ "acceptance": 0.0034498795212099366, "n_count_vectors": 30485, "kind": "finetune", "domain": 0, "length": 128, "aligned": false, "target_persona": "M", "pass_given_true_target_sector": 0.8739944329552939, "accepted_mean_target_joint_posterior": 0.9896115886778125}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859{ "0.1": { "target": 0.1, "guard": 0.02, "source_bank": "development_T", "crossings": { "lower_guard": { "threshold": 0.08, "crossing": null }, "target": { "threshold": 0.1, "crossing": null }, "upper_guard": { "threshold": 0.12, "crossing": null } } }, "0.2": { "target": 0.2, "guard": 0.02, "source_bank": "development_T", "crossings": { "lower_guard": { "threshold": 0.18, "crossing": null }, "target": { "threshold": 0.2, "crossing": null }, "upper_guard": { "threshold": 0.22, "crossing": null } } }, "0.3": { "target": 0.3, "guard": 0.02, "source_bank": "development_T", "crossings": { "lower_guard": { "threshold": 0.28, "crossing": null }, "target": { "threshold": 0.3, "crossing": null }, "upper_guard": { "threshold": 0.32, "crossing": null } } }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265{ "arguments": { "mode": "finetune", "n": 128, "eta": 1.0, "seed": 3, "device": "cuda:0", "eval_precision": "float32", "train_precision": "float32", "matmul_precision": "highest", "out": "results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population", "archive_prefix": "old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population", "checkpoint_repo": "dmanningcoe/simplex-research-archive", "allow_public_checkpoints": true, "defer_upload": false, "resume": "results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/pretrain_100000/pretrain_step090000.pt", "qualification": "results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/qualification/qualification.json", "audit_seed": null, "bank_seed_offset": 10000000, "steps": 1000, "batch": 256, "lr": 1e-05, "weight_decay": null, "pretrain_target": "sampled", "oracle_chunk": 32, "anchor_per_sector": 0, "check_every": 1000, "audit_per_sector": 256, "audit_prompts": 512, "continuation_prompts": 512, "continuation_repeats": 64, "final_prompts": 1024, "ft_kind": "population", "progress_guard": 0.02, "source_n": null, "width": 128, "layers": 3, "allow_failed_pilot_ft": false, "stop_on_gate": false, "stop_on_development_pass": false, "development_min_step": null, "development_max_bias": null, "development_max_continuation_kl": null, "threads": 4, "rollout_prompts": 0, "rollout_repeats": 256 }, "process": { "n": 128, "s": 0.25, "coupling": 0.2, "spread": 0.25, "eta": 1.0 }, "information": { "persona_bits": 0.04556599707503495, "domain_bits": 0.005913647024115454, "ratio": 7.705227736660623 }, "model": { "vocab_size": 5, "n_ctx": 256, "d_model": 128, "n_heads": 4, "n_layers": 3, "d_mlp": 512, "use_mlp": true, "dropout": 0.0, "init_std": 0.01, "act_fn": "gelu", "mup": false, "mup_base_width": 64 }, "resume_checkpoint_sha256": "cdbef0d08d918635b7ec89c639d89514b6301405df89a8841e613cf112a855ed", "base_proposal_qualified": true, "qualification": { "certificate": { "schema_version": 1, "source_checkpoint_sha256": "cdbef0d08d918635b7ec89c639d89514b6301405df89a8841e613cf112a855ed", "source_checkpoint_name": "pretrain_step090000.pt", "process": { "n": 128, "s": 0.25, "coupling": 0.2, "spread": 0.25, "eta": 1.0 }, "model": { "vocab_size": 5, "n_ctx": 256, "d_model": 128, "n_heads": 4, "n_layers": 3, "d_mlp": 512, "use_mlp": true, "dropout": 0.0, "init_std": 0.01, "act_fn": "gelu", "mup": false, "mup_base_width": 64 }, "outcomes": { "numeric_gates_passed": true, "proposal_sample_size": true, "untouched_namespace_declared": true, "proposal_qualified": true }, "audited_quality_file": "independent_audit.json", "audited_quality_sha256": "8d0547d61c3eac2f55205adc4fec33fda144b0ada84fc973a2e59e6c31655a0e", "audit_provenance": { "source_hashes": { "experiments/pbm_sprint_train.py": "623388ae45410de2e2a38548fc95da4cb6b6f7a12dce3bb05ce7fb2363c8912b", "bag_moments/pbm_sprint.py": "c9331527e4dbcde6b3687a45a670e701bdca7ad640c37d5d58c401380a25a7cd", "bag_moments/pbm_progress.py": "8729d599afb4bd34837d720a0ced708b41e2f533f665cfcaa86198e40e92e3b0", "bag_moments/pbm_stratified.py": "7d8658c5544cde5085b714b9af0e7c43727860800d06fa65fa59b485deb61375", "bag_moments/pbm_qualification.py": "58d1dd8855b022902023ecdbc835c31d709a640f97432680591a7fffd9658c9c", "bag_moments/persona_bottleneck_coins.py": "ed66f068a3c160849448b1d4c66eaf484a04bfd3422995db08a6003eb35a891c", "bag_moments/model.py": "5d34c4d48113a845df9431139d818ce0a2667c98decd3a9b668f981b90928cd5" }, "precision": { "training": "float32", "evaluation": "float32", "matmul": "highest" }, "torch_version": "2.9.1+cu128", "jax_version": "0.8.2", "audit_stream": { "partition": "independent_confirmation", "namespace": 1000150000, "namespace_explicit": true, "sector_seed": 1000150001, "prompt_seeds": [ 1000150101, 1000150102 ], "continuation_prompt_seeds": [ 1000150201, 1000150202 ], "continuation_seeds": [ 1000150301, 1000150302 ], "bank_seed_offset": 10000000, "prompt_bank_sha256": { "T": "d7033334a6a18a128546d06e41ad85c7d15b0f6db3e6e68ef39ddbc729c3d8b7", "O": "6c19671ee354fe39d28a118a5df9ec6047da20d3fac4d8a6a14b3656c8266a89" }, "process": { "n": 128, "s": 0.25, "coupling": 0.2, "spread": 0.25, "eta": 1.0 } } } }, "certificate_sha256": "9676524a7386997fb2957c205746059593a9709276780450625b5eff0b60deea", "certificate_path": "/data/users/dmitry/pbm-sprint-20261008/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/qualification/qualification.json" }, "parameters": 629120, "host": "g374", "checkpoint_archive": { "repo": "dmanningcoe/simplex-research-archive", "visibility": "public", "prefix": "old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population", "public_upload_authorized": true, "source_exclusions": [ "source/bag_moments/model.py", "source/bag_moments/persona_bottleneck_coins.py" ] }, "torch_version": "2.9.1+cu128", "jax_version": "0.8.2", "lr": 1e-05, "precision": { "training": "float32", "evaluation": "float32", "matmul": "highest" }, "development_stopping": { "enabled": false, "minimum_step": null, "maximum_bias": null, "maximum_continuation_kl": null, "full_independent_qualification_required": true }, "population_sampler": { "kind": "native uniform persona and domain" }, "bank_roles": { "development_T": "checkpoint candidates", "final_T": "endpoint-selection T", "final_O": "untouched held-out endpoint scores" }, "encoding": "2*(U==+1)+V; BOS=4, BOS output masked", "pretrain_length": 192, "ft_length": 128, "optimizer": { "name": "AdamW", "betas": [ 0.9, 0.999 ], "eps": 1e-08, "weight_decay": 0.01, "parameter_group_weight_decay": [ 0.01 ], "schedule": "constant" }, "audit_is_proposal_size": true, "source_hashes": { "experiments/pbm_sprint_train.py": "623388ae45410de2e2a38548fc95da4cb6b6f7a12dce3bb05ce7fb2363c8912b", "bag_moments/pbm_sprint.py": "c9331527e4dbcde6b3687a45a670e701bdca7ad640c37d5d58c401380a25a7cd", "bag_moments/pbm_progress.py": "8729d599afb4bd34837d720a0ced708b41e2f533f665cfcaa86198e40e92e3b0", "bag_moments/pbm_stratified.py": "7d8658c5544cde5085b714b9af0e7c43727860800d06fa65fa59b485deb61375", "bag_moments/pbm_qualification.py": "58d1dd8855b022902023ecdbc835c31d709a640f97432680591a7fffd9658c9c", "bag_moments/persona_bottleneck_coins.py": "ed66f068a3c160849448b1d4c66eaf484a04bfd3422995db08a6003eb35a891c", "bag_moments/model.py": "5d34c4d48113a845df9431139d818ce0a2667c98decd3a9b668f981b90928cd5" }, "source_snapshots": { "experiments/pbm_sprint_train.py": { "path": "source/experiments/pbm_sprint_train.py", "sha256": "623388ae45410de2e2a38548fc95da4cb6b6f7a12dce3bb05ce7fb2363c8912b" }, "bag_moments/pbm_sprint.py": { "path": "source/bag_moments/pbm_sprint.py", "sha256": "c9331527e4dbcde6b3687a45a670e701bdca7ad640c37d5d58c401380a25a7cd" }, "bag_moments/pbm_progress.py": { "path": "source/bag_moments/pbm_progress.py", "sha256": "8729d599afb4bd34837d720a0ced708b41e2f533f665cfcaa86198e40e92e3b0" }, "bag_moments/pbm_stratified.py": { "path": "source/bag_moments/pbm_stratified.py", "sha256": "7d8658c5544cde5085b714b9af0e7c43727860800d06fa65fa59b485deb61375" }, "bag_moments/pbm_qualification.py": { "path": "source/bag_moments/pbm_qualification.py", "sha256": "58d1dd8855b022902023ecdbc835c31d709a640f97432680591a7fffd9658c9c" }, "bag_moments/persona_bottleneck_coins.py": { "path": "source/bag_moments/persona_bottleneck_coins.py", "sha256": "ed66f068a3c160849448b1d4c66eaf484a04bfd3422995db08a6003eb35a891c" }, "bag_moments/model.py": { "path": "source/bag_moments/model.py", "sha256": "5d34c4d48113a845df9431139d818ce0a2667c98decd3a9b668f981b90928cd5" } }, "checkpoint_archive_history": [ { "repo": "dmanningcoe/simplex-research-archive", "prefix": "old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population", "visibility": "not_yet_verified", "public_upload_authorized": true, "public_source_exclusions": [ "source/bag_moments/model.py", "source/bag_moments/persona_bottleneck_coins.py" ] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162[ { "step": 0, "tokens": 0, "T": { "readout": 0.49829243424755987, "change": 0.0, "paired_prompt_se": 0.0, "out_of_range": 0.0 }, "O": { "readout": 0.50207883519397, "change": 0.0, "paired_prompt_se": 0.0, "out_of_range": 0.0 } }, { "step": 1, "tokens": 32768, "T": { "readout": 0.5048985397515935, "change": 0.006606105504033621, "paired_prompt_se": 6.834002118528218e-06, "out_of_range": 0.0 }, "O": { "readout": 0.5083446053795342, "change": 0.006265770185564179, "paired_prompt_se": 6.521023362777162e-06, "out_of_range": 0.0 } }, { "step": 3, "tokens": 98304, "T": { "readout": 0.5109453245568147, "change": 0.012652890309254872, "paired_prompt_se": 1.5704064645167075e-05, "out_of_range": 0.0 }, "O": { "readout": 0.5109496705808851, "change": 0.008870835386915132, "paired_prompt_se": 1.2633511708885897e-05, "out_of_range": 0.0 } }, { "step": 5, "tokens": 163840, "T": { "readout": 0.5122063361268374, "change": 0.013913901879277546, "paired_prompt_se": 2.2529003022904434e-05, "out_of_range": 0.0 }, "O": { "readout": 0.509931558091921, "change": 0.007852722897951026, "paired_prompt_se": 2.1070749615274466e-05, "out_of_range": 0.0 } }, { "step": 9, "tokens": 294912, "T": { "readout": 0.5100078322720947, "change": 0.011715398024534807, "paired_prompt_se": 3.5591599532720485e-05, "out_of_range": 0.0 }, "O": { "readout": 0.5031418647886312, "change": 0.0010630295946612023, "paired_prompt_se": 2.3668235747175573e-05, "out_of_range": 0.0 } }, { "step": 18, "tokens": 589824, "T": { "readout": 0.5020668646320701, "change": 0.0037744303845101967, "paired_prompt_se": 5.2687490901904784e-05, "out_of_range": 0.0 }, "O": { "readout": 0.4915104804058501, "change": -0.010568354788119905, "paired_prompt_se": 5.8757948251286005e-05, "out_of_range": 0.0 } }, { "step": 40, "tokens": 1310720, "T": { "readout": 0.49499153553915676, "change": -0.0033008987084031105, "paired_prompt_se": 5.882001290234592e-05, "out_of_range": 0.0 }, "O": { "readout": 0.5019240274996264, "change": -0.00015480769434361719, "paired_prompt_se": 7.411059028263864e-05, "out_of_range": 0.0 } }, { "step": 100, "tokens": 3276800, "T": { "readout": 0.47669329443306196, "change": -0.021599139814497903, "paired_prompt_se": 5.822283055207258e-05, "out_of_range": 0.0 }, "O": { "readout": 0.4912281241668097, "change": -0.010850711027160287, "paired_prompt_se": 8.084840929847391e-05, "out_of_range": 0.0 } }, { "step": 300, "tokens": 9830400, "T": { "readout": 0.49492328306951094, "change": -0.0033691511780489236, "paired_prompt_se": 6.636893364983764e-05, "out_of_range": 0.0 }, "O": { "readout": 0.49407598941616016, "change": -0.008002845777809853, "paired_prompt_se": 0.00012370222948403106, "out_of_range": 0.0 } }, { "step": 1000, "tokens": 32768000, "T": { "readout": 0.48961063601018395, "change": -0.008681798237375915, "paired_prompt_se": 0.00010052186606080712, "out_of_range": 0.0 }, "O": { "readout": 0.5232639529385779, "change": 0.02118511774460785, "paired_prompt_se": 9.62840467942279e-05, "out_of_range": 0.0 } }]123version https://git-lfs.github.com/spec/v1oid sha256:456bc775c9d7198e84b8fdf6b8ac3222362975c9ace8ec3996a7565a23c6321csize 75503123version https://git-lfs.github.com/spec/v1oid sha256:1db33abc1ba619360eb81bb8f6f04e9546b976027870bfd38fb6f0646febb629size 8525123version https://git-lfs.github.com/spec/v1oid sha256:2ec1b8f0f25edfaa36155902def094d8e11c89e4b2852951897b0515b62d8b92size 8466123version https://git-lfs.github.com/spec/v1oid sha256:c502a54df786060b204b2340eeb513e4a5eb633705643c1dec6dbebc2b5ec5bcsize 8402123version https://git-lfs.github.com/spec/v1oid sha256:9080568b9b7149f347f5f683b7b8aa61b4b3a309576c3ef2da0615d8c373fc60size 8423123version https://git-lfs.github.com/spec/v1oid sha256:60e23862ecadc7379a0b7c298b9c81162fbb09ab19a1d30b78e916d17f0571bdsize 8502123version https://git-lfs.github.com/spec/v1oid sha256:cff95a773bb1285dae7c262c0b7cad994d5bf3a45e134587212758fe4dfd901bsize 8567123version https://git-lfs.github.com/spec/v1oid sha256:d9aa5fbcc5558dcefcc730396c0323e92d5e1ee4718fbc31d24bd41c72a1f0f3size 8596123version https://git-lfs.github.com/spec/v1oid sha256:9bda253fc415c49e10672463cfa08495b6490b28c640d00a4d2d62b6d28c09dfsize 8612123version https://git-lfs.github.com/spec/v1oid sha256:cf985b9de0242474b5880d65c090f2e110f735f864ab136a005111e037cbb9bfsize 8642123version https://git-lfs.github.com/spec/v1oid sha256:4f76addbe963881b85efda8535233d812271e77a3fbc124ff07df5e19630db9csize 8588123456789101112131415161718192021222324{ "T": { "acceptance": 6.496874864914279e-05, "n_count_vectors": 90, "kind": "evaluation", "domain": 0, "length": 64, "aligned": false, "target_persona": "M", "pass_given_true_target_sector": 0.00810821960766034, "accepted_mean_target_joint_posterior": 0.4875072015542214 }, "O": { "acceptance": 6.496874864914283e-05, "n_count_vectors": 90, "kind": "evaluation", "domain": 1, "length": 64, "aligned": false, "target_persona": "M", "pass_given_true_target_sector": 0.008108219607660345, "accepted_mean_target_joint_posterior": 0.4875072015542214 }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899"""T-only guard checkpoint selection and interpolation without extrapolation.
Development T creates the candidate set. A separate endpoint-selection T bankchooses a chronological upward bracket within that set. O is not accepted bythe selection API. Selected scalar interpolation weights do not define a modelor a continuation law: roll out each actual selected checkpoint separately."""import math
def guard_plan(target,guard): if not 0<guard<target: raise ValueError('Require 0 < progress guard < target') return dict(target=float(target),guard=float(guard),source_bank='development_T', crossings={name:dict(threshold=round(value,12),crossing=None) for name,value in [('lower_guard',target-guard),('target',target),('upper_guard',target+guard)]})
def record_guard_crossings(plan,previous,current,step): """Mutate a plan only at a threshold's first upward development crossing.""" if not all(math.isfinite(x) for x in (previous,current)) or step<1: raise ValueError('Finite development values and a positive step required') recorded=[] for name,item in plan['crossings'].items(): threshold=item['threshold'] if item['crossing'] is None and previous<threshold<=current: item['crossing']=dict(lower_step=step-1,upper_step=step, lower_progress=float(previous),upper_progress=float(current)) recorded.append(name) return recorded
def select_endpoint(plan,t_values,max_width=.04): """Select using endpoint-T values at ONLY this plan's guard candidates.
Pairs must be chronological adjacent candidates and strictly upward. Rank by smallest T width, then earliest upper step. Exact numeric equality resolves a single checkpoint; no equality tolerance or extrapolation is used. """ target=float(plan['target']) guard=float(plan['guard']) if not 0<guard<target or not math.isfinite(max_width) or max_width<=0: raise ValueError('Invalid target guard or maximum bracket width') expected={'lower_guard':round(target-guard,12),'target':round(target,12), 'upper_guard':round(target+guard,12)} if set(plan['crossings'])!=set(expected) or any(plan['crossings'][k]['threshold']!=v for k,v in expected.items()): raise ValueError('Candidate plan is not the target\'s three declared guard crossings') candidates=set() for item in plan['crossings'].values(): crossing=item['crossing'] if crossing is None: continue lower,upper=crossing['lower_step'],crossing['upper_step'] if (not isinstance(lower,int) or not isinstance(upper,int) or lower<0 or upper!=lower+1 or not crossing['lower_progress']<item['threshold']<=crossing['upper_progress']): raise ValueError('Invalid first-upward development crossing record') candidates.update([lower,upper]) steps=sorted(candidates) output=dict(target=target,guard=guard,candidate_steps=steps,selection_bank='endpoint_selection_T', development_crossings_observed=[name for name,item in plan['crossings'].items() if item['crossing'] is not None], heldout_bank='untouched_final_O',max_width=max_width,equality_rule='exact numeric equality', selection_rule='chronological adjacent upward candidates; smallest T width, then earliest upper step', model_interpolation=False) if any(step not in t_values for step in steps): return dict(**output,resolved=False,reason='missing endpoint-selection T values for candidate checkpoints') values={step:float(t_values[step]) for step in steps} output['candidate_T_values']={str(step):value for step,value in values.items()} if any(not math.isfinite(value) for value in values.values()): return dict(**output,resolved=False,reason='nonfinite endpoint-selection T value') exact=[step for step in steps if values[step]==target] if exact: step=min(exact) return dict(**output,resolved=True,lower_step=step,upper_step=step, lower_T=target,upper_T=target,width=0.,interpolation_fraction=0., checkpoints=[dict(step=step,weight=1.)]) eligible=[] for lower,upper in zip(steps[:-1],steps[1:]): width=values[upper]-values[lower] if width>0 and width<=max_width and values[lower]<=target<=values[upper]: eligible.append((width,upper,lower)) if not eligible: return dict(**output,resolved=False,reason='no eligible upward T bracket within guard candidates') width,upper,lower=min(eligible) fraction=(target-values[lower])/width if not 0<=fraction<=1: return dict(**output,resolved=False,reason='interpolation fraction outside [0,1]') return dict(**output,resolved=True,lower_step=lower,upper_step=upper, lower_T=values[lower],upper_T=values[upper],width=width,interpolation_fraction=fraction, checkpoints=[dict(step=lower,weight=1-fraction),dict(step=upper,weight=fraction)])
def interpolate_readout(selection,values): """Apply already-frozen scalar weights; never use O to choose checkpoints.""" if not selection['resolved']: return None weights=selection['checkpoints'] if any(not 0<=item['weight']<=1 for item in weights) or abs(sum(item['weight'] for item in weights)-1)>1e-12: raise ValueError('Invalid interpolation weights') return sum(item['weight']*float(values[item['step']]) for item in weights)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122"""Full-audit qualification bound to immutable checkpoint and audit bytes."""import hashlibimport jsonfrom pathlib import Pathimport math
def audit_stream_seeds(audit_seed=None,bank_seed_offset=0,fresh=True): """Explicit qualification namespaces are distinct from legacy pilot streams.
The caller must freeze a previously unused explicit namespace before looking at its results. This records that declaration; it cannot prove non-use in external work. Bank offsets pair development/final data within a main sweep. """ explicit=fresh and audit_seed is not None if explicit: base=int(audit_seed) result=dict(partition='independent_confirmation',namespace=base,namespace_explicit=True, sector_seed=base+1,prompt_seeds=[base+101,base+102], continuation_prompt_seeds=[base+201,base+202],continuation_seeds=[base+301,base+302]) else: offset=int(bank_seed_offset) result=dict(partition='reused_legacy_confirmation' if fresh else 'development', namespace=None,namespace_explicit=False,sector_seed=910001+int(fresh)+offset, prompt_seeds=[(830001 if fresh else 810001)+offset+i for i in range(2)], continuation_prompt_seeds=[(850001 if fresh else 840001)+offset+i for i in range(2)], continuation_seeds=[930001+100*int(fresh)+offset+i for i in range(2)]) result['bank_seed_offset']=int(bank_seed_offset) seeds=[result['sector_seed']]+result['prompt_seeds']+result['continuation_prompt_seeds']+result['continuation_seeds'] if any(seed<0 or seed>=2**32 for seed in seeds): raise ValueError('All derived audit stream seeds must be valid uint32 values') if explicit: known_pilot={910001,910002,810001,810002,820001,820002,830001,830002, 840001,840002,850001,850002,930001,930002,930101,930102} development={910001+bank_seed_offset,810001+bank_seed_offset,810002+bank_seed_offset, 820001+bank_seed_offset,820002+bank_seed_offset,840001+bank_seed_offset, 840002+bank_seed_offset,930001+bank_seed_offset,930002+bank_seed_offset} if set(seeds)&(known_pilot|development): raise ValueError('Explicit audit namespace collides with known pilot/development/final stream seeds') return result
def sha256(path): return hashlib.sha256(Path(path).read_bytes()).hexdigest()
def quality_outcomes(quality): """Recompute eligibility from audit measurements and actual sample counts.""" try: prompt=quality['prompts'] cont=quality['continuation'] values=[quality['mean_kl'],quality['worst_sector_kl']] for name in ('T','O'): values.extend([prompt[name]['mae'],prompt[name]['signed_error']['mean'],cont[name]['mean']]) numeric=(all(math.isfinite(float(x)) for x in values) and -1e-7<=quality['mean_kl']<=.001 and -1e-7<=quality['worst_sector_kl']<=.005 and all(0<=prompt[name]['mae']<=.02 and abs(prompt[name]['signed_error']['mean'])<=.005 and -1e-5<=cont[name]['mean']<=.005 for name in ('T','O'))) untouched=(quality['audit_stream']['partition']=='independent_confirmation' and quality['audit_stream']['namespace_explicit'] is True and quality['audit_stream']['namespace'] is not None) full=(quality['per_sector']>=256 and quality['prefixes']==[0,1,2,4,8,16,32,64,128,191] and all(prompt[name]['count']>=512 and cont[name]['prompts']>=512 and cont[name]['repeats']>=64 and cont[name]['horizon']==128 for name in ('T','O'))) except (KeyError,TypeError,ValueError) as error: raise ValueError('Audit lacks required measurements or sample counts') from error return dict(numeric_gates_passed=bool(numeric),proposal_sample_size=bool(full), untouched_namespace_declared=bool(untouched),proposal_qualified=bool(numeric and full and untouched))
def development_candidate_passes(quality,maximum_bias,maximum_continuation_kl,step=0,minimum_step=0): """Conservative development stop, never a substitute for full qualification.
Sample sizes may be reduced. Recompute every original numerical gate and require the additional margins in both T and O; don't trust cached flags. """ if (not isinstance(step,int) or not isinstance(minimum_step,int) or minimum_step<0 or step<0 or not 0<=maximum_bias<=.005 or not 0<=maximum_continuation_kl<=.005): raise ValueError('Development stopping requires nonnegative steps and conservative margins <= .005') return bool(step>=minimum_step and quality_outcomes(quality)['numeric_gates_passed'] and all(abs(quality['prompts'][name]['signed_error']['mean'])<=maximum_bias and quality['continuation'][name]['mean']<=maximum_continuation_kl for name in ('T','O')))
def make_certificate(checkpoint,process,model,quality_file): quality_file=Path(quality_file) quality=json.loads(quality_file.read_text()) if quality.get('audit_stream',{}).get('process')!=process: raise ValueError('Qualification audit used a different process for its prompt banks') return dict(schema_version=1,source_checkpoint_sha256=sha256(checkpoint), source_checkpoint_name=Path(checkpoint).name,process=process,model=model, outcomes=quality_outcomes(quality),audited_quality_file=quality_file.name, audited_quality_sha256=sha256(quality_file))
def validate_certificate(certificate_file,checkpoint,process,model): path=Path(certificate_file) certificate=json.loads(path.read_text()) if certificate.get('schema_version')!=1: raise ValueError('Unsupported qualification certificate schema') if certificate.get('source_checkpoint_sha256')!=sha256(checkpoint): raise ValueError('Qualification certificate belongs to a different checkpoint SHA256') if certificate.get('process')!=process or certificate.get('model')!=model: raise ValueError('Qualification certificate process/model differs') quality_file=path.parent/certificate['audited_quality_file'] if not quality_file.is_file() or sha256(quality_file)!=certificate.get('audited_quality_sha256'): raise ValueError('Qualification audit file is absent or its SHA256 differs') quality=json.loads(quality_file.read_text()) if quality.get('audit_stream',{}).get('process')!=process: raise ValueError('Qualification audit used a different process for its prompt banks') outcomes=quality_outcomes(quality) recorded=certificate.get('outcomes',{}) required=('numeric_gates_passed','proposal_sample_size','proposal_qualified') if (any(recorded.get(key)!=outcomes[key] for key in required) or ('untouched_namespace_declared' in recorded and recorded['untouched_namespace_declared']!=outcomes['untouched_namespace_declared'])): raise ValueError('Qualification certificate outcomes disagree with the bound audit') if not outcomes['proposal_qualified']: raise ValueError('Qualification requires passing numeric gates and the full proposal audit') return dict(certificate=certificate,certificate_sha256=sha256(path), certificate_path=str(path.resolve()),quality=quality)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352"""Proposal-faithful coin instruments for the October 2026 PBM sprint.
Public tokens use 2*1{U=+1}+V, unlike the earlier pilot's encoding.The existing audited generator/table implementation is adapted explicitly."""from dataclasses import dataclassimport typesimport numpy as npimport torchimport torch.nn.functional as Ffrom scipy.special import xlogyfrom bag_moments import persona_bottleneck_coins as oldfrom bag_moments.model import GPTConfig, TinyGPT
BOS = 4PREFIXES = (0, 1, 2, 4, 8, 16, 32, 64, 128, 191)
@dataclass(frozen=True)class Process(old.CoinConfig): eta: float = 1.
def __post_init__(self): super().__post_init__() if not 0 < self.eta <= 1: raise ValueError('background eta must be in (0,1]')
@property def biases(self): p = super().biases.copy() p[2:] = .5 + self.eta*(p[2:]-.5) return p
@property def symbol_emissions(self): return self.emissions[:, :, [2, 3, 0, 1]]
def counts(obs): return old.token_counts(obs)
def require_iid(cfg): """Prevent persistent atoms silently entering iid-only instruments.""" if getattr(cfg,'kappa',0.)!=0: raise ValueError('This is an iid coin instrument; use pbm_atoms for nonzero-kappa processes')
def posterior(c, cfg): require_iid(cfg) return old.posterior_counts(np.asarray(c)[..., [2, 3, 0, 1]], cfg)
def oracle(c, cfg): require_iid(cfg) return old.oracle_next(np.asarray(c)[..., [2, 3, 0, 1]], cfg)[:, [2, 3, 0, 1]]
def draw(key, cfg, batch, length, personas=None, domains=None): require_iid(cfg) obs, z, d = old.draw(key, cfg, batch, length, personas, domains) return obs ^ 2, z, d
def selected_table(cfg, length, domain, kind, aligned=False): require_iid(cfg) # Symmetry (U,V,p)->(-U,1-V,1-p) maps aligned domain T to # misaligned domain O while retaining exact mixture and gate probabilities. table = old.selection_table(cfg, length, domain ^ int(aligned), kind) table = dict(table) permutation = [1, 0, 3, 2] if aligned else [2, 3, 0, 1] table['counts'] = table['counts'][:, permutation] table['domain'] = domain table['aligned'] = aligned table['target_persona'] = 'A' if aligned else 'M' table['pass_given_true_target_sector'] = table.pop('pass_given_true_MD') table['accepted_mean_target_joint_posterior'] = table.pop('accepted_mean_joint_posterior') return table
selected_sampler = old.selected_samplerselection_metadata = old.selection_metadata
def information_at(c, cfg): require_iid(cfg) def h(p): return -(xlogy(p, p)+xlogy(1-p, 1-p))/np.log(2) pm, pd = posterior(c, cfg) mu = (1+cfg.s*(1-2*pm))/2 pbar = pd @ cfg.biases ip = h(mu)-h((1+cfg.s)/2) domplus = h(pbar+cfg.coupling)-pd@h(cfg.biases+cfg.coupling) domminus = h(pbar-cfg.coupling)-pd@h(cfg.biases-cfg.coupling) return ip, mu*domplus+(1-mu)*domminus
def flash_attention(self, x, extra_mask=None): if extra_mask is not None: raise ValueError('sprint driver does not use attention ablation') b, t, c = x.shape q, k, v = self.qkv(x).split(c, dim=2) q, k, v = [a.view(b, t, self.n_heads, self.d_head).transpose(1, 2) for a in (q, k, v)] y = F.scaled_dot_product_attention(q, k, v, is_causal=True, dropout_p=0., scale=self.attn_scale) return self.proj(y.transpose(1, 2).contiguous().view(b, t, c))
def make_model(device, width=128, layers=3): cfg = GPTConfig(vocab_size=5, n_ctx=256, d_model=width, n_heads=4, n_layers=layers, d_mlp=4*width, init_std=.01, dropout=0., act_fn='gelu') model = TinyGPT(cfg).to(device) for block in model.blocks: block.attn.forward = types.MethodType(flash_attention, block.attn) return model
def tensor(obs, device): return torch.as_tensor(np.asarray(obs).copy(), dtype=torch.long, device=device)
def with_bos(seq): return torch.cat([torch.full((len(seq), 1), BOS, dtype=seq.dtype, device=seq.device), seq], dim=1)
def amp(device): return torch.autocast('cuda', dtype=torch.bfloat16, enabled=str(device).startswith('cuda'))
def evaluation_amp(model,device): return torch.autocast('cuda',dtype=torch.bfloat16, enabled=str(device).startswith('cuda') and not getattr(model,'eval_fp32',False))
def process_logits(model, seq): # Slice before softmax/loss: deterministic BOS is NEVER an output symbol. return model(seq)[..., :4].float()
def cached_logits(model, seq, cache=None): """Same TinyGPT computation with exact full-history K/V reuse.
First call consumes BOS+prompt. Later calls consume one observed token. No sliding window, dropout, or hidden-state reset is introduced. """ offset=0 if cache is None else cache[0][0].shape[2] if offset and seq.shape[1]!=1: raise ValueError('cache updates accept one token at a time') if offset+seq.shape[1]>model.cfg.n_ctx: raise ValueError('generation exceeds model context') positions=torch.arange(offset,offset+seq.shape[1],device=seq.device) x=model.tok_emb(seq)+model.pos_emb(positions)[None] updated=[] for index,block in enumerate(model.blocks): attn=block.attn b,t,c=x.shape q,k,v=attn.qkv(block.ln1(x)).split(c,dim=2) q,k,v=[a.view(b,t,attn.n_heads,attn.d_head).transpose(1,2) for a in (q,k,v)] if cache is not None: k=torch.cat([cache[index][0],k],dim=2) v=torch.cat([cache[index][1],v],dim=2) updated.append((k,v)) y=F.scaled_dot_product_attention(q,k,v,is_causal=cache is None, dropout_p=0.,scale=attn.attn_scale) x=x+attn.proj(y.transpose(1,2).contiguous().view(b,t,c)) if block.mlp is not None: x=x+block.mlp(block.ln2(x)) return model.head(model.ln_f(x))[...,:4].float(),updated
@torch.no_grad()def oracle_targets_torch(seq,cfg,chunk=32): """FP32 Bayes targets for every prefix BEFORE its observed target token.
This is an oracle evaluator; observations still come from the JAX process. Chunk the batch axis to avoid materializing B*L*N domain posteriors at once. Empty-prefix targets are included. No generating latent labels are used. """ require_iid(cfg) if seq.ndim!=2 or chunk<1: raise ValueError('expected two-dimensional tokens and a positive chunk') with torch.autocast(device_type=seq.device.type,enabled=False): log_domain=torch.tensor(np.log(cfg.domain_emissions[:,[2,3,0,1]]).T, dtype=torch.float32,device=seq.device) biases=torch.tensor(cfg.biases,dtype=torch.float32,device=seq.device) output=[] for start in range(0,len(seq),chunk): onehot=F.one_hot(seq[start:start+chunk],num_classes=4).float() c=onehot.cumsum(1)-onehot length=c.sum(-1) plus_count=c[...,2:].sum(-1) pm=torch.sigmoid(-(2*plus_count-length)*float(np.log((1+cfg.s)/(1-cfg.s)))) # Four explicit FP32 products avoid TF32 GEMM rounding even when # the model uses torch.set_float32_matmul_precision('high'). loglik=sum(c[...,symbol,None]*log_domain[symbol] for symbol in range(4)) domain=loglik.softmax(-1) mean_p=(domain*biases).sum(-1) plus=(1+cfg.s*(1-2*pm))/2 output.append(torch.stack([(1-plus)*(1-mean_p+cfg.coupling), (1-plus)*(mean_p-cfg.coupling),plus*(1-mean_p-cfg.coupling), plus*(mean_p+cfg.coupling)],dim=-1)) return torch.cat(output,dim=0)
def train_step(model, optimizer, obs, device, oracle_cfg=None, oracle_chunk=32,sequence_weights=None): model.train() seq = tensor(obs, device) targets=oracle_targets_torch(seq,oracle_cfg,oracle_chunk) if oracle_cfg is not None else None weights=None if sequence_weights is not None: array=np.asarray(sequence_weights,dtype=np.float64) if array.shape!=(len(seq),) or not np.all(np.isfinite(array)) or np.any(array<=0): raise ValueError('Each sequence must have a finite positive population weight') weights=torch.as_tensor(array,dtype=torch.float32,device=device) optimizer.zero_grad(set_to_none=True) with torch.autocast('cuda',dtype=torch.bfloat16, enabled=str(device).startswith('cuda') and not getattr(model,'train_fp32',False)): logits = process_logits(model, with_bos(seq[:, :-1])) if targets is None: if weights is None: loss = F.cross_entropy(logits.reshape(-1, 4), seq.reshape(-1)) else: per_sequence=F.cross_entropy(logits.reshape(-1,4),seq.reshape(-1),reduction='none').view(len(seq),-1).mean(1) loss=(weights*per_sequence).mean() else: per_token=-(targets*logits.log_softmax(-1)).sum(-1) loss=per_token.mean() if weights is None else (weights*per_token.mean(1)).mean() loss.backward() # Proposal has ordinary AdamW; do not add unrecorded clipping. optimizer.step() return float(loss.detach())
@torch.no_grad()def next_probabilities(model, prompts, device, batch=128): model.eval() out = [] for start in range(0, len(prompts), batch): with evaluation_amp(model,device): logits = process_logits(model, with_bos(tensor(prompts[start:start+batch], device)))[:, -1] out.append(logits.softmax(-1).cpu().numpy()) return np.concatenate(out).astype(np.float64)
def persona_readout(prob, cfg): require_iid(cfg) mean_u = prob[:, 2:].sum(1)-prob[:, :2].sum(1) return (1-mean_u/cfg.s)/2
def _stats(values): a = np.asarray(values, dtype=np.float64) return dict(mean=float(a.mean()), se=float(a.std(ddof=1)/np.sqrt(len(a))) if len(a)>1 else 0.)
@torch.no_grad()def fidelity(model, cfg, device, seed, per_sector=16, prompts=None, batch=128): """Balanced audit; oracle sees exactly the prefix available to the model.""" require_iid(cfg) import jax z = np.repeat(np.arange(2), cfg.n*per_sector) d = np.tile(np.repeat(np.arange(cfg.n), per_sector), 2) # Generation in chunks avoids allocating a giant N1024 audit on device. all_kl = [] model.eval() for start in range(0, len(z), batch): stop = min(start+batch, len(z)) obs, _, _ = draw(jax.random.fold_in(jax.random.key(seed), start), cfg, stop-start, 191, z[start:stop], d[start:stop]) with evaluation_amp(model,device): pred = process_logits(model, with_bos(tensor(obs, device)))[:, PREFIXES].softmax(-1).cpu().numpy() c = np.stack([counts(obs[:, :length]) for length in PREFIXES], axis=1) truth = oracle(c.reshape(-1, 4), cfg).reshape(pred.shape) all_kl.append(np.sum(truth*(np.log(truth)-np.log(np.maximum(pred, 1e-30))), axis=-1)) kl = np.concatenate(all_kl).reshape(2, cfg.n, per_sector, len(PREFIXES)) sector = kl.mean(axis=(2, 3)) result = dict(mean_kl=float(kl.mean()), worst_sector_kl=float(sector.max()), sector_kl=sector.tolist(), prefix_kl=kl.mean(axis=(0, 1, 2)).tolist(), prefixes=list(PREFIXES), per_sector=per_sector, mean_sequence_kl_se=float(kl.mean(-1).std(ddof=1)/np.sqrt(2*cfg.n*per_sector))) result['sector_gate'] = result['mean_kl'] <= .001 and result['worst_sector_kl'] <= .005 result['prompts'] = {} for name, bank in (prompts or {}).items(): predicted = persona_readout(next_probabilities(model, bank, device, batch), cfg) truth = posterior(counts(bank), cfg)[0] error = predicted-truth result['prompts'][name] = dict(count=len(bank),mae=float(np.abs(error).mean()), signed_error=_stats(error), readout=_stats(predicted), out_of_range=float(np.mean((predicted<0)|(predicted>1)))) result['prompt_gate'] = all(v['mae'] <= .02 and abs(v['signed_error']['mean']) <= .005 for v in result['prompts'].values()) return result
@torch.no_grad()def continuation_fidelity(model, cfg, device, prompts, seed, repeats=4, horizon=128, batch=64): """Sum of exact next-token KL along true conditional continuations.
Monte Carlo units are prompts; first average all repeats per prompt. This is original-process fidelity, NOT distance to a refitted family. """ require_iid(cfg) import jax bank = np.repeat(prompts, repeats, axis=0) rng = np.random.default_rng(seed) all_kl = [] model.eval() for start in range(0, len(bank), batch): p = bank[start:start+batch] pm, pd = posterior(counts(p), cfg) z = (rng.random(len(p)) < pm).astype(int) d = np.array([rng.choice(cfg.n, p=b) for b in pd]) y, _, _ = draw(jax.random.fold_in(jax.random.key(seed), start), cfg, len(p), horizon, z, d) seq = np.concatenate([p, y], axis=1) with evaluation_amp(model,device): pred = process_logits(model, with_bos(tensor(seq[:, :-1], device)))[:, p.shape[1]:].softmax(-1).cpu().numpy() c = np.stack([(seq == symbol).cumsum(1) for symbol in range(4)], axis=-1) c = c[:, p.shape[1]-1:-1] truth = oracle(c.reshape(-1, 4), cfg).reshape(pred.shape) all_kl.append(np.sum(truth*(np.log(truth)-np.log(np.maximum(pred, 1e-30))), axis=(-1, -2))) vals = np.concatenate(all_kl).reshape(len(prompts), repeats).mean(1) return dict(**_stats(vals), passed=bool(vals.mean() <= .005), prompts=len(prompts), repeats=repeats, horizon=horizon, units='nats per complete continuation', prompt_values=vals.tolist())
@torch.no_grad()def rollout(model, prompts, device, horizon, seed, batch=128): model.eval() gen = torch.Generator(device=device).manual_seed(seed) continuations, log_probabilities = [], [] for start in range(0, len(prompts), batch): seq = with_bos(tensor(prompts[start:start+batch], device)) with evaluation_amp(model,device): logits,cache=cached_logits(model,seq) logits=logits[:,-1] ys, lps = [], [] for step in range(horizon): logp = logits.log_softmax(-1) y = torch.multinomial(logp.exp(), 1, generator=gen) ys.append(y.cpu().numpy()) lps.append(logp.gather(1, y).cpu().numpy()) if step+1<horizon: with evaluation_amp(model,device): logits,cache=cached_logits(model,y,cache) logits=logits[:,-1] continuations.append(np.concatenate(ys, axis=1)) log_probabilities.append(np.concatenate(lps, axis=1)) return np.concatenate(continuations), np.concatenate(log_probabilities)1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465"""Exact-population weighted stratification of rare coin anchors.
Four fixed strata are (A,T), (M,T), (A,O), (M,O); the fifth is the originalmixture conditional on a nonanchor domain. Draw ordinary complete processsequences in each stratum, without filtering observed tokens or audit prompts.For n_s draws in stratum s with true probability pi_s, use loss = sum_s pi_s * mean_{i in s} loss_i.The equivalent per-example weight in a batch mean is B*pi_s/n_s. Never divideby a sampled sum of weights. This preserves the expected population loss andgradient, including with the ORIGINAL population Bayes oracle as soft target.It changes sampling noise and optimizer trajectories. Oversampling anchorsreduces their estimator variance; total gradient variance need not decrease."""import numpy as npimport jaxfrom bag_moments.pbm_sprint import draw,require_iid
def plan(cfg,batch,anchor_per_sector): require_iid(cfg) m=int(anchor_per_sector) if m<1 or batch<4*m: raise ValueError('Require positive anchor count and batch >= 4*anchor_per_sector') background=batch-4*m if (cfg.n>2 and background<1) or (cfg.n==2 and background!=0): raise ValueError('Positive-mass strata require samples; zero-mass background must have none') strata=[] for domain in (0,1): for persona in (0,1): strata.append(dict(name=('A' if persona==0 else 'M')+('_T' if domain==0 else '_O'), persona=persona,domain=domain,count=m,population_mass=1/(2*cfg.n), example_weight=batch/(2*cfg.n*m))) if background: mass=(cfg.n-2)/cfg.n strata.append(dict(name='background',persona=None,domain=None,count=background, population_mass=mass,example_weight=batch*mass/background)) return dict(batch=batch,anchor_per_sector=m,strata=strata, anchor_exposure_multiplier=2*cfg.n*m/batch, weighted_objective='sum_s population_mass_s * mean(loss within stratum s)', target_oracle='original uniform-prior process, never the sampling proposal')
def draw_stratified(key,cfg,batch,length,anchor_per_sector): spec=plan(cfg,batch,anchor_per_sector) kz,kd,kperm,kdraw=jax.random.split(key,4) personas=[] domains=[] weights=[] for stratum in spec['strata']: size=stratum['count'] if stratum['name']=='background': z=np.asarray(jax.random.randint(kz,(size,),0,2)) d=np.asarray(jax.random.randint(kd,(size,),2,cfg.n)) else: z=np.full(size,stratum['persona'],dtype=np.int32) d=np.full(size,stratum['domain'],dtype=np.int32) personas.append(z) domains.append(d) weights.append(np.full(size,stratum['example_weight'],dtype=np.float64)) permutation=np.asarray(jax.random.permutation(kperm,batch)) z=np.concatenate(personas)[permutation] d=np.concatenate(domains)[permutation] w=np.concatenate(weights)[permutation] obs,z,d=draw(kdraw,cfg,batch,length,z,d) return obs,z,d,w123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495"""Reproducible PBM coin pilot with strict, separately reported fidelity gates.
Run with uv run python experiments/pbm_sprint_train.py --help.All training checkpoints are saved with optimizer state and uploaded. Reducingaudit counts is supported for pilots and never changes numerical thresholds."""import osos.environ.setdefault('JAX_PLATFORMS', 'cpu')os.environ.setdefault('XLA_PYTHON_CLIENT_PREALLOCATE', 'false')import argparseimport copyfrom dataclasses import asdictimport hashlibimport jsonfrom pathlib import Pathimport sysimport timeROOT = Path(__file__).resolve().parents[1]sys.path.insert(0, str(ROOT))import jaximport numpy as npimport torchfrom huggingface_hub import HfApi, get_tokenfrom threadpoolctl import threadpool_limitsfrom bag_moments.pbm_sprint import (Process, draw, selected_table, selected_sampler, selection_metadata, make_model, train_step, fidelity, continuation_fidelity, next_probabilities, persona_readout, counts, posterior, information_at, rollout)from bag_moments.pbm_qualification import sha256,make_certificate,validate_certificate,audit_stream_seeds,development_candidate_passesfrom bag_moments.pbm_stratified import plan as stratification_plan,draw_stratifiedfrom bag_moments.pbm_progress import guard_plan,record_guard_crossings,select_endpoint,interpolate_readout
PUBLIC_SOURCE_EXCLUSIONS=['source/bag_moments/model.py', 'source/bag_moments/persona_bottleneck_coins.py']
def write_json(path, obj): temp = path.with_suffix(path.suffix+'.tmp') temp.write_text(json.dumps(obj, indent=2, allow_nan=False)+'\n') temp.replace(path)
def snapshot_sources(out, source_hashes, root=ROOT): """Preserve each manifested source verbatim; refuse changed or stale bytes.""" snapshots={} for relative,expected in source_hashes.items(): source=root/relative data=source.read_bytes() if hashlib.sha256(data).hexdigest()!=expected: raise RuntimeError('Source changed while creating manifest: '+relative) destination=out/'source'/relative destination.parent.mkdir(parents=True,exist_ok=True) with destination.open('xb') as stream: stream.write(data) if sha256(destination)!=expected: raise RuntimeError('Source snapshot verification failed: '+relative) snapshots[relative]=dict(path=str(destination.relative_to(out)),sha256=expected) return snapshots
def upload(out, prefix, repo='dmanningcoe/simplex-edl-checkpoints', allow_public=False): token = os.environ.get('HF_TOKEN') or get_token() if not token: raise RuntimeError('No HF authentication; local checkpoints remain incomplete pending upload') os.environ['HF_TOKEN'] = token api = HfApi(token=token) private=api.repo_info(repo, repo_type='dataset').private if not private and not allow_public: raise RuntimeError('Required checkpoint repository is not private') archive_config=dict(repo=repo,visibility='private' if private else 'public',prefix=prefix, public_upload_authorized=allow_public, source_exclusions=PUBLIC_SOURCE_EXCLUSIONS if not private else []) if (out/'manifest.json').exists(): manifest=json.loads((out/'manifest.json').read_text()) previous_archive=manifest.get('checkpoint_archive') if previous_archive and previous_archive!=archive_config: manifest.setdefault('checkpoint_archive_history',[]).append(previous_archive) manifest['checkpoint_archive']=archive_config write_json(out/'manifest.json',manifest) commit = api.upload_folder(repo_id=repo, repo_type='dataset', folder_path=out, path_in_repo=prefix, ignore_patterns=['*.tmp', 'archive_receipt.json', '*.log']+archive_config['source_exclusions'], allow_patterns=['*.pt','*.json','*.jsonl','*.npz','*.npy','*.py'], commit_message=f'Persona bottleneck sprint: {out.name}') receipts = [] for path in sorted(out.glob('*.pt')): remote = api.get_paths_info(repo, [prefix+'/'+path.name], repo_type='dataset', revision=commit.oid)[0] sha = hashlib.sha256(path.read_bytes()).hexdigest() if remote.size != path.stat().st_size or (remote.lfs and remote.lfs.sha256 != sha): raise RuntimeError('Uploaded checkpoint verification failed: '+path.name) receipts.append(dict(path=prefix+'/'+path.name, bytes=path.stat().st_size, sha256=sha)) receipt = dict(**archive_config, commit=commit.oid, checkpoints=receipts) write_json(out/'archive_receipt.json', receipt) return receipt
def main(): p = argparse.ArgumentParser(description=__doc__) p.add_argument('--mode', choices=['pretrain', 'finetune', 'archive', 'benchmark', 'audit'], default='pretrain') p.add_argument('--n', type=int, default=8) p.add_argument('--eta', type=float, default=1.) p.add_argument('--seed', type=int, default=100) p.add_argument('--device', default='cuda:0') p.add_argument('--eval-precision', choices=['bfloat16','float32'], default='bfloat16') p.add_argument('--train-precision',choices=['bfloat16','float32'],default='bfloat16') p.add_argument('--matmul-precision',choices=['highest','high'],default='high') p.add_argument('--out', type=Path, required=True) p.add_argument('--archive-prefix') p.add_argument('--checkpoint-repo',default='dmanningcoe/simplex-edl-checkpoints') p.add_argument('--allow-public-checkpoints',action='store_true',help='explicit authorization to upload this run to a public dataset') p.add_argument('--defer-upload', action='store_true', help='retain all local checkpoints, explicitly leave run incomplete pending archive') p.add_argument('--resume', type=Path) p.add_argument('--qualification',type=Path,help='full independent audit certificate bound to the exact resume checkpoint') p.add_argument('--audit-seed',type=int,help='explicit previously unused namespace for qualification; absent preserves reused legacy confirmation streams') p.add_argument('--bank-seed-offset',type=int,default=0,help='offset shared development/final bank seeds; freeze a new offset for a main sweep') p.add_argument('--steps', type=int, default=20000) p.add_argument('--batch', type=int, default=256) p.add_argument('--lr', type=float) p.add_argument('--weight-decay',type=float,help='default .01 for a new optimizer; preserve resumed optimizer unless explicitly set') p.add_argument('--pretrain-target',choices=['sampled','oracle'],default='sampled', help='oracle soft targets reduce target noise without changing population expected CE') p.add_argument('--oracle-chunk',type=int,default=32) p.add_argument('--anchor-per-sector',type=int,default=0,help='optional population-weighted strata: fixed samples per persona/anchor sector; zero preserves uniform sampling') p.add_argument('--check-every', type=int, default=1000) p.add_argument('--audit-per-sector', type=int, default=256) p.add_argument('--audit-prompts', type=int, default=512) p.add_argument('--continuation-prompts', type=int, default=512) p.add_argument('--continuation-repeats', type=int, default=64) p.add_argument('--final-prompts', type=int, default=1024) p.add_argument('--ft-kind', choices=['misaligned', 'aligned', 'population'], default='misaligned') p.add_argument('--progress-guard',type=float,help='optional T-development guard crossings around .1/.2/.3 endpoints') p.add_argument('--source-n', type=int, help='shared accepted corpus source; absent means native law') p.add_argument('--width', type=int, default=128) p.add_argument('--layers', type=int, default=3) p.add_argument('--allow-failed-pilot-ft', action='store_true', help='explicit exploratory only override') p.add_argument('--stop-on-gate', action='store_true') p.add_argument('--stop-on-development-pass',action='store_true',help='opt-in reduced-audit conservative stopping; full independent qualification still required') p.add_argument('--development-min-step',type=int) p.add_argument('--development-max-bias',type=float) p.add_argument('--development-max-continuation-kl',type=float) p.add_argument('--threads', type=int, default=4) p.add_argument('--rollout-prompts', type=int, default=0) p.add_argument('--rollout-repeats', type=int, default=256) args = p.parse_args() development_margins=(args.development_min_step,args.development_max_bias,args.development_max_continuation_kl) if args.stop_on_development_pass: if (args.mode!='pretrain' or any(value is None for value in development_margins) or args.development_min_step<0 or not 0<=args.development_max_bias<=.005 or not 0<=args.development_max_continuation_kl<=.005): raise ValueError('Development stopping requires pretraining, an explicit nonnegative minimum step, and both margins in [0,.005]') elif any(value is not None for value in development_margins): raise ValueError('Development stopping margins require --stop-on-development-pass') if args.qualification and (args.mode!='finetune' or args.resume is None): raise ValueError('--qualification requires fine-tuning with --resume') if args.anchor_per_sector<0 or (args.anchor_per_sector and args.mode not in ('pretrain','benchmark')): raise ValueError('Anchor stratification is a nonnegative pretraining/benchmark option only') if args.progress_guard is not None and (args.mode!='finetune' or not 0<args.progress_guard<.1): raise ValueError('Progress guards require fine-tuning and 0 < guard < .1') if args.source_n is not None and args.mode!='finetune' and args.source_n!=args.n: raise ValueError('Pretraining and qualification audits require native process prompt banks') audit_stream_seeds(args.audit_seed,args.bank_seed_offset,True) audit_stream_seeds(args.audit_seed,args.bank_seed_offset,False) if not 0<=820002+args.bank_seed_offset<2**32: raise ValueError('Final bank seeds outside uint32 range') if args.pretrain_target=='oracle' and args.mode=='finetune': raise ValueError('oracle targets are a pretraining diagnostic, not accepted-law fine-tuning targets') out = args.out.resolve() out.mkdir(parents=True, exist_ok=True) prefix = args.archive_prefix or 'results/persona_bottleneck_sprint_20261008/'+out.name if args.mode == 'archive': receipt=upload(out, prefix,args.checkpoint_repo,args.allow_public_checkpoints) if (out/'summary.json').exists(): summary=json.loads((out/'summary.json').read_text()) if summary.get('status')=='training_complete_upload_pending': summary['status']='complete' summary['archive_commit']=receipt['commit'] write_json(out/'summary.json',summary) if (out/'archive_pending.json').exists(): (out/'archive_pending.json').unlink() print(json.dumps(receipt), flush=True) return if (out/'manifest.json').exists(): raise RuntimeError('Use a new output folder; refusing to overwrite a recorded run') torch.set_num_threads(args.threads) threadpool_limits(args.threads) torch.manual_seed(args.seed) torch.set_float32_matmul_precision(args.matmul_precision) cfg = Process(n=args.n, eta=args.eta) strata=stratification_plan(cfg,args.batch,args.anchor_per_sector) if args.anchor_per_sector else None model = make_model(args.device, args.width, args.layers) model.eval_fp32=args.eval_precision=='float32' model.train_fp32=args.train_precision=='float32' lr = args.lr if args.lr is not None else (.002 if args.mode == 'finetune' else .001) weight_decay=.01 if args.weight_decay is None else args.weight_decay optimizer = torch.optim.AdamW(model.parameters(), lr=lr, betas=(.9,.999), eps=1e-8, weight_decay=weight_decay) start_step = 0 previous = None qualification=None resume_sha256=None base_qualified=False if args.resume: previous = torch.load(args.resume, map_location=args.device, weights_only=False) resume_sha256=sha256(args.resume) if previous['process'] != asdict(cfg): raise ValueError('Checkpoint process differs') model.load_state_dict(previous['model']) if previous.get('model_config',asdict(model.cfg))!=asdict(model.cfg): raise ValueError('Checkpoint model configuration differs') base_qualified=bool(previous.get('strict_gate_passed',False)) if args.qualification: if args.mode!='finetune': raise ValueError('--qualification is a fine-tuning authorization input') qualification=validate_certificate(args.qualification,args.resume,asdict(cfg),asdict(model.cfg)) base_qualified=True if args.mode == 'pretrain': optimizer.load_state_dict(previous['optimizer']) start_step = previous['step'] if args.lr is not None: for group in optimizer.param_groups: group['lr']=args.lr else: lr=optimizer.param_groups[0]['lr'] if args.weight_decay is not None: for group in optimizer.param_groups: group['weight_decay']=args.weight_decay else: weight_decay=optimizer.param_groups[0]['weight_decay'] if args.steps<=start_step: raise ValueError('--steps must exceed resumed checkpoint step') if args.mode == 'finetune' and not base_qualified and not args.allow_failed_pilot_ft: raise RuntimeError('FT requires accepted base or explicit exploratory override') if args.mode=='finetune' and previous.get('mode') not in (None,'pretrain'): raise ValueError('Fine-tuning arms must start from a pretraining checkpoint') elif args.mode in ('finetune', 'audit'): raise ValueError('This mode requires --resume') base_quality=qualification['quality'] if qualification else (previous.get('quality') if previous else None) t0 = time.time() def event(**data): row = dict(elapsed_s=time.time()-t0, **data) print(json.dumps(row), flush=True) with (out/'events.jsonl').open('a') as f: f.write(json.dumps(row)+'\n') manifest = dict(arguments={k:str(v) if isinstance(v,Path) else v for k,v in vars(args).items()}, process=asdict(cfg), information=cfg.information(), model=asdict(model.cfg), resume_checkpoint_sha256=resume_sha256,base_proposal_qualified=base_qualified, qualification={key:value for key,value in qualification.items() if key!='quality'} if qualification else None, parameters=sum(x.numel() for x in model.parameters()), host=os.uname().nodename, checkpoint_archive=dict(repo=args.checkpoint_repo,prefix=prefix, visibility='not_yet_verified',public_upload_authorized=args.allow_public_checkpoints, public_source_exclusions=PUBLIC_SOURCE_EXCLUSIONS), torch_version=torch.__version__, jax_version=jax.__version__, lr=lr, precision=dict(training=args.train_precision,evaluation=args.eval_precision,matmul=args.matmul_precision), development_stopping=dict(enabled=args.stop_on_development_pass,minimum_step=args.development_min_step, maximum_bias=args.development_max_bias,maximum_continuation_kl=args.development_max_continuation_kl, full_independent_qualification_required=True), population_sampler=strata or dict(kind='native uniform persona and domain'), bank_roles=dict(development_T='checkpoint candidates',final_T='endpoint-selection T' if args.progress_guard else 'final T readout', final_O='untouched held-out endpoint scores'), encoding='2*(U==+1)+V; BOS=4, BOS output masked', pretrain_length=192, ft_length=128, optimizer=dict(name='AdamW', betas=[.9,.999], eps=1e-8, weight_decay=weight_decay, parameter_group_weight_decay=[group['weight_decay'] for group in optimizer.param_groups],schedule='constant'), audit_is_proposal_size=(args.audit_per_sector>=256 and args.audit_prompts>=512 and args.continuation_prompts>=512 and args.continuation_repeats>=64), source_hashes={str(path.relative_to(ROOT)):hashlib.sha256(path.read_bytes()).hexdigest() for path in (Path(__file__), ROOT/'bag_moments/pbm_sprint.py', ROOT/'bag_moments/pbm_progress.py', ROOT/'bag_moments/pbm_stratified.py', ROOT/'bag_moments/pbm_qualification.py', ROOT/'bag_moments/persona_bottleneck_coins.py', ROOT/'bag_moments/model.py')}) manifest['source_snapshots']=snapshot_sources(out,manifest['source_hashes']) write_json(out/'manifest.json', manifest) event(stage='start', mode=args.mode, n=cfg.n, eta=cfg.eta, parameters=manifest['parameters']) def archive(): if not args.defer_upload: return upload(out,prefix,args.checkpoint_repo,args.allow_public_checkpoints) pending=dict(status='upload_pending',repo=args.checkpoint_repo,prefix=prefix, public_upload_authorized=args.allow_public_checkpoints, checkpoints=[p.name for p in sorted(out.glob('*.pt'))]) write_json(out/'archive_pending.json',pending) return dict(commit=None) final_status='training_complete_upload_pending' if args.defer_upload else 'complete' def training_key(step): namespace={'benchmark':10,'pretrain':11,'finetune':12}.get(args.mode,13) return jax.random.fold_in(jax.random.fold_in(jax.random.key(args.seed),namespace),step) def population_batch(step): if args.anchor_per_sector: return draw_stratified(training_key(step),cfg,args.batch,192,args.anchor_per_sector) obs,z,d=draw(training_key(step),cfg,args.batch,192) return obs,z,d,None
if args.mode == 'benchmark': for step in range(args.steps): obs, _, _, weights = population_batch(step) loss = train_step(model, optimizer, obs, args.device, cfg if args.pretrain_target=='oracle' else None,args.oracle_chunk,weights) if str(args.device).startswith('cuda'): torch.cuda.synchronize() event(stage='benchmark', step=step+1, loss=loss) torch.save(dict(model=model.state_dict(), optimizer=optimizer.state_dict(), process=asdict(cfg), step=args.steps, strict_gate_passed=False), out/'benchmark.pt') receipt=archive() write_json(out/'summary.json',dict(status=final_status,archive_commit=receipt['commit'])) return
source = Process(n=args.source_n or args.n, eta=args.eta) tables = {name:selected_table(source, 64, domain, 'evaluation') for name,domain in [('T',0),('O',1)]} samplers = {k:selected_sampler(v) for k,v in tables.items()} # Banks independent of training seed so prompt orders are paired across seeds. dev = {k:samplers[k](jax.random.key(810001+args.bank_seed_offset+i), args.audit_prompts) for i,k in enumerate(('T','O'))} final = {k:samplers[k](jax.random.key(820001+args.bank_seed_offset+i), args.final_prompts) for i,k in enumerate(('T','O'))} np.savez_compressed(out/'prompts.npz', **{'dev_'+k:v for k,v in dev.items()}, **{'final_'+k:v for k,v in final.items()}) write_json(out/'selection.json', {k:selection_metadata(v) for k,v in tables.items()}) def audit(tag, fresh=False): streams=audit_stream_seeds(args.audit_seed,args.bank_seed_offset,fresh) bank = ({k:samplers[k](jax.random.key(streams['prompt_seeds'][i]), args.audit_prompts) for i,k in enumerate(('T','O'))} if fresh else dev) result = fidelity(model, cfg, args.device, streams['sector_seed'], args.audit_per_sector, bank) result['audit_stream']=dict(**streams, prompt_bank_sha256={k:hashlib.sha256(v.tobytes()).hexdigest() for k,v in bank.items()}, process=asdict(source)) # Cheap gates first; still measure continuation fidelity for diagnostic value. result['continuation'] = {} for i,k in enumerate(('T','O')): pbank = samplers[k](jax.random.key(streams['continuation_prompt_seeds'][i]), args.continuation_prompts) result['continuation'][k] = continuation_fidelity(model, cfg, args.device, pbank, streams['continuation_seeds'][i], args.continuation_repeats) result['numeric_gates_passed'] = (result['sector_gate'] and result['prompt_gate'] and all(v['passed'] for v in result['continuation'].values())) result['proposal_sample_size'] = manifest['audit_is_proposal_size'] result['untouched_namespace_declared']=streams['namespace_explicit'] result['proposal_qualified'] = result['numeric_gates_passed'] and result['proposal_sample_size'] and streams['namespace_explicit'] result['strict_gate_passed'] = result['proposal_qualified'] write_json(out/(tag+'.json'),result) event(stage='audit',tag=tag,mean_kl=result['mean_kl'],worst_sector_kl=result['worst_sector_kl'], prompt_mae={k:v['mae'] for k,v in result['prompts'].items()}, continuation_kl={k:v['mean'] for k,v in result['continuation'].items()}, numeric_gates_passed=result['numeric_gates_passed'], strict_gate_passed=result['strict_gate_passed']) return result
exposure = np.zeros((2,cfg.n),dtype=np.int64) weighted_exposure=np.zeros((2,cfg.n),dtype=np.float64) if args.mode=='pretrain' and previous is not None: exposure=np.asarray(previous.get('sector_exposure',exposure)).copy() weighted_exposure=np.asarray(previous.get('weighted_sector_exposure',exposure),dtype=np.float64).copy() def snapshot(step, quality): return dict(model=copy.deepcopy(model.state_dict()), optimizer=copy.deepcopy(optimizer.state_dict()), model_config=asdict(model.cfg), process=asdict(cfg), step=step, mode=args.mode, seed=args.seed, torch_rng=torch.get_rng_state(), cuda_rng=torch.cuda.get_rng_state_all() if torch.cuda.is_available() else [], generator_rule='fold_in(fold_in(key(seed), stage_namespace), step); benchmark=10, pretrain=11, finetune=12', sector_exposure=exposure.copy(), weighted_sector_exposure=weighted_exposure.copy(), strict_gate_passed=bool(args.mode=='pretrain' and quality and quality.get('strict_gate_passed')), base_proposal_qualified=base_qualified if args.mode=='finetune' else None, quality_scope='base_pretraining' if args.mode=='finetune' else 'current_model',quality=quality) def checkpoint(name, step, quality): torch.save(snapshot(step,quality),out/(name+'.pt'))
if args.mode == 'audit': q=audit('independent_audit',True) certificate=make_certificate(args.resume,asdict(cfg),asdict(model.cfg),out/'independent_audit.json') certificate['audit_provenance']=dict(source_hashes=manifest['source_hashes'], precision=manifest['precision'],torch_version=torch.__version__,jax_version=jax.__version__, audit_stream=q['audit_stream']) write_json(out/'qualification.json',certificate) write_json(out/'summary.json',dict(status='audit_complete',quality=q,qualification=certificate, qualification_sha256=sha256(out/'qualification.json'))) return if args.mode == 'pretrain': q=None for step in range(start_step+1,args.steps+1): obs,z,d,weights=population_batch(step) np.add.at(exposure,(z,d),1) np.add.at(weighted_exposure,(z,d),1 if weights is None else weights) loss=train_step(model,optimizer,obs,args.device, cfg if args.pretrain_target=='oracle' else None,args.oracle_chunk,weights) if step==start_step+1 or step%100==0: event(stage='pretrain',step=step,loss=loss,tokens=(step-start_step)*args.batch*192) if step%args.check_every==0 or step==args.steps: q=audit(f'dev_step{step:06d}') checkpoint(f'pretrain_step{step:06d}',step,q) # Persist each saved trained checkpoint before declaring its block done. receipt=archive() event(stage='archive_pending' if args.defer_upload else 'archived',step=step,commit=receipt['commit']) if args.stop_on_development_pass and development_candidate_passes(q, args.development_max_bias,args.development_max_continuation_kl,step,args.development_min_step): event(stage='conservative_development_stop',step=step, full_independent_qualification_required=True) break if q['numeric_gates_passed'] and q['proposal_sample_size'] and args.stop_on_gate: break qfinal=audit('confirmation',True) checkpoint('pretrained',step,qfinal) receipt=archive() write_json(out/'summary.json',dict(status=final_status,strict_gate_passed=qfinal['strict_gate_passed'], numeric_gates_passed=qfinal['numeric_gates_passed'],proposal_qualified=qfinal['proposal_qualified'], proposal_sample_size=manifest['audit_is_proposal_size'],step=step,archive_commit=receipt['commit'], elapsed_s=time.time()-t0,sector_exposure=exposure.tolist(),weighted_sector_exposure=weighted_exposure.tolist())) return
ft_table=selected_table(source,128,0,'finetune',aligned=args.ft_kind=='aligned') ft_sampler=selected_sampler(ft_table) write_json(out/'ft_selection.json',selection_metadata(ft_table)) baseline={k:persona_readout(next_probabilities(model,b,args.device),cfg) for k,b in final.items()} base_dev=persona_readout(next_probabilities(model,dev['T'],args.device),cfg) metrics=[] crossing={str(t):None for t in (.1,.2,.3)} guards={str(t):guard_plan(t,args.progress_guard) for t in (.1,.2,.3)} if args.progress_guard else None direction=-1 if args.ft_kind=='aligned' else 1 previous_progress=0. saved_steps=set() def measure(step, saved=None): current=None if saved is not None: current=copy.deepcopy(model.state_dict()) model.load_state_dict(saved['model']) row=dict(step=step,tokens=step*args.batch*128) arrays={} for k,bank in final.items(): r=persona_readout(next_probabilities(model,bank,args.device),cfg) delta=r-baseline[k] arrays[k]=r row[k]=dict(readout=float(r.mean()),change=float(delta.mean()), paired_prompt_se=float(delta.std(ddof=1)/np.sqrt(len(delta))), out_of_range=float(np.mean((r<0)|(r>1)))) np.savez_compressed(out/f'readouts_step{step:04d}.npz',**arrays) metrics.append(row) write_json(out/'metrics.json',metrics) if saved is None: checkpoint(f'finetuned_step{step:04d}',step,base_quality) else: torch.save(saved,out/f'finetuned_step{step:04d}.pt') saved_steps.add(step) event(stage='ft_evaluation',**row) if args.rollout_prompts: selected=np.repeat(final['O'][:args.rollout_prompts],args.rollout_repeats,axis=0) y,lp=rollout(model,selected,args.device,128,950001,args.batch) np.savez_compressed(out/f'rollout_step{step:04d}.npz',prompts=selected,continuations=y,token_logp=lp) if current is not None: model.load_state_dict(current) measure(0) standard={1,3,5,9,18,40,100,300,1000,args.steps} # Retain the last step in memory; every checkpoint actually written to disk # is preserved and uploaded. Both crossing endpoints get final-panel scores. rolling_state=snapshot(0,base_quality) for step in range(1,args.steps+1): if args.ft_kind=='population': obs,_,_=draw(training_key(step),cfg,args.batch,128) else: obs=ft_sampler(training_key(step),args.batch) loss=train_step(model,optimizer,obs,args.device) r=persona_readout(next_probabilities(model,dev['T'],args.device),cfg) progress=float(direction*(r-base_dev).mean()) crossed=[] guard_crossed={} for target in (.1,.2,.3): if crossing[str(target)] is None and previous_progress<target<=progress: crossing[str(target)]=dict(lower_step=step-1,upper_step=step, lower_progress=previous_progress,upper_progress=progress, bracket_width=progress-previous_progress,needs_finer_update=progress-previous_progress>.04) crossed.append(target) if guards: for target,plan in guards.items(): newly=record_guard_crossings(plan,previous_progress,progress,step) if newly: guard_crossed[target]=newly if crossed or guard_crossed: if step-1 not in saved_steps: measure(step-1,rolling_state) write_json(out/'crossings.json',crossing) if guards: write_json(out/'guard_crossings.json',guards) if step in standard or crossed or guard_crossed: measure(step) outstanding=(any(item['crossing'] is None for plan in guards.values() for item in plan['crossings'].values()) if guards else any(value is None for value in crossing.values())) if outstanding: rolling_state=snapshot(step,base_quality) previous_progress=progress if step%10==0 or crossed or guard_crossed: event(stage='finetune',step=step,loss=loss,dev_progress=progress,crossed=crossed,guard_crossed=guard_crossed) endpoints=None if guards: write_json(out/'guard_crossings.json',guards) t_values={row['step']:direction*row['T']['change'] for row in metrics} o_values={row['step']:row['O']['change'] for row in metrics} endpoints={target:select_endpoint(plan,t_values) for target,plan in guards.items()} for selection in endpoints.values(): if selection['resolved']: selection['heldout_raw_change']=interpolate_readout(selection,o_values) selection['heldout_directional_change']=direction*selection['heldout_raw_change'] for checkpoint_entry in selection['checkpoints']: path=out/f"finetuned_step{checkpoint_entry['step']:04d}.pt" checkpoint_entry.update(path=path.name,sha256=sha256(path)) write_json(out/'endpoints.json',endpoints) receipt=archive() write_json(out/'summary.json',dict(status=final_status,archive_commit=receipt['commit'],crossings=crossing, endpoints=endpoints, exploratory_failed_base=not base_qualified,elapsed_s=time.time()-t0))
if __name__=='__main__': main()old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/endpoints.jsonAdded+47
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/events.jsonlAdded+111
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step0000.ptAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step0001.ptAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step0003.ptAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step0005.ptAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step0009.ptAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step0018.ptAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step0040.ptAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step0100.ptAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step0300.ptAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/finetuned_step1000.ptAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/ft_selection.jsonAdded+11
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/guard_crossings.jsonAdded+59
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/manifest.jsonAdded+265
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/metrics.jsonAdded+162
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/prompts.npzAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step0000.npzAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step0001.npzAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step0003.npzAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step0005.npzAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step0009.npzAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step0018.npzAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step0040.npzAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step0100.npzAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step0300.npzAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/readouts_step1000.npzAdded+3
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/selection.jsonAdded+24
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/source/bag_moments/pbm_progress.pyAdded+99
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/source/bag_moments/pbm_qualification.pyAdded+122
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/source/bag_moments/pbm_sprint.pyAdded+352
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/source/bag_moments/pbm_stratified.pyAdded+65
old_results/results/persona_bottleneck_sprint_20261008/main_n128_eta1_seed3/ft_population/source/experiments/pbm_sprint_train.pyAdded+495